Page 1 of 1

Pass extra params in server EventHandler

Posted: 06 Dec 2021, 16:18
by moccha
Hi,

Is it possible to pass additional parameters from the server to the client when firing certain events? For example, is it possible to pass extra variables when a USER_JOIN_ROOM request is handled serverside?

Server:

Code: Select all

this.addEventHandler(SFSEventType.USER_JOIN_ROOM, JoinRoomHandler.class);
and within JoinRoomHandler.class:

Code: Select all

public class JoinRoomHandler extends BaseServerEventHandler 
{
    @Override
    public void handleServerEvent(ISFSEvent event) throws SFSException
    {	
        // Get event param
        SFSRoom room = (SFSRoom) event.getParameter(SFSEventParam.ROOM);
        
        // Pass extra data to process clientside SFSEvent event
        ...
    }
}
I want to send a few extra variables to the client (from server) when another user joins their room.

Re: Pass extra params in server EventHandler

Posted: 06 Dec 2021, 17:56
by Lapo
Hi,
sorry it's not possible. The server-side events are not linked to the client side ones, in fact they travel in separate threads. Also when the server triggers the USER_JOIN_ROOM event, the relative client has already been sent out.

Cheers

Re: Pass extra params in server EventHandler

Posted: 06 Dec 2021, 18:27
by moccha
OK, I will look to sending another update within USER_JOIN_ROOM then.

Thanks for the info Lapo.