Sending data to browsers with different session identifiers

Say I have an online game with four players and my my webapp knows the session identifiers of the four separate sessions, say they are strings s1 to s4, how do I send data to one session at a time? For example I might want to send each player a different hand of cards and different buttons to go in their own private rectangle on a web page. I assume this must involve updatebrowser - but there must also be some way of setting the current session before the call. Is it as simple as looping through the 4 sessions and specifying te identifiers before sending the 4 sets of data?

Almost. You’ll keep this idea as the core of the function, but to the code has to run without a session context. This can be done with a normal Timer which runs on the server, and raises its Run event on the main thread. Once you’re clear of a session context you can loop through sessions looking for the correct players and sending their session commands.

You can also do this from HandleEvent, meaning the individual sessions could send commands in through that mechanism. Just make sure you authenticate, otherwise anyone could send a command.

Thanks for that information, guys