why "Assigning actions to events" doesn't work?
Dear,
In my authorization plug-in, I set a method which I hope it can be called by SSAS when connect event occurs.
void FmsAuthAdaptor::notify(IFmsAuthEvent* pAev)
{
processStats(pAev);
MyFmsNotifyEvent(pAev, m_pFmsAuthServerContext).notify();
}
void FmsAuthAdaptor::processStats(IFmsAuthEvent* pAev)
{
if (pAev->getType() == IFmsAuthEvent::E_CONNECT)
{
FmsVariant field;
if (pAev->getField(IFmsAuthEvent::F_CLIENT_ID, field) == IFmsAuthEvent::S_SUCCESS)
{
m_pFmsAuthServerContext->log("before ssas method", IFmsServerContext::kInformation, false);
I64 clientId = field.i64;
IFmsNotifyAction* pAction = pAev->addNotifyAction("Notified by adaptor");
pAction->setClientId(field);
const char mtd[] = "my_test";
field.setString(reinterpret_cast<I8*>(const_cast<char*>(mtd)));
pAction->setMethodName(field);
// create and insert a U16 "12345" as the first parameter
field.setU16(12345);
pAction->addParam(field);
// create and insert clientId as a double as the second parameter
field.setDouble((double)clientId);
pAction->addParam(field);
m_pFmsAuthServerContext->log("after ssas method", IFmsServerContext::kInformation, false);
}
}
}
In my application directory, I create a script named as main.asc. I have the following codes:
application.onConnect = function(client)
{
application.acceptConnection( client );
trace("MJF:application.onConnect" );
client.my_test = function(userParam, clientId)
{
trace("MJF:in my_test ");
}
trace("MJF: after my_test");
}
but, I don't know why:
when a client connected in, I can see the traces "MJF:application.onConnect", and "MJF: after my_test", but I can not see "MJF:in my_test". seems my_test method is not called by SSAS. Assigning actions to events doesn't work? why?
is there anyone who can tell me why? Thanks in advance!
