[muscle] Re: Updating the message storage database server side

  • From: "Jeremy Friesner" <jaf@xxxxxxxxxxxx>
  • To: muscle@xxxxxxxxxxxxx
  • Date: Wed, 10 Dec 2003 09:06:08 PST (-0800)

Hi Marius,

> So what am I missing=3F Is there any easy way to send messages from one 
> server 
> side session to another=3F

There are several ways to do this, found in the ServerComponent API (of which
StorageReflectSession is a subclass).   One easy way is to call 
using a node-path string that matches only the session you want to receive the 

// Send myMsgRef only to session #0, i.e. the first session the server 
SendMessageToMatchingSessions(myMsgRef, "/*/0", QueryFilterRef(), false);

Or, you can do the same thing "by hand" (and somewhat more efficiently), by 
a pointer or reference to the session you wish to send the Message to, and then 
calling MessageReceivedFromSession(*this, msgRef, NULL) on that session.

For example:

AbstractReflectSession gameStateRef =3D GetSession("0");  // get ref to first 
instantiated session
if (gameStateRef()) gameStateRef()->MessageReceivedFromSession(*this, myMsgRef, 


HashtableIterator<const char *, AbstractReflectSessionRef> iter =3D 
const char * nextKey;
AbstractReflectSessionRef nextSessionRef;
while(iter.GetNextKeyAndValue(nextKey, nextSessionRef) =3D=3D B=5FNO=5FERROR)
   if (your=5Fcriteria=5Fhere) 
nextSessionRef()->MessageReceivedFromSession(*this, myMsgRef, NULL);


Other related posts: