Not sended ExtensionResponse in OnRoomJoined event

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

edisoni
Posts: 2
Joined: 07 Jun 2018, 03:55

Not sended ExtensionResponse in OnRoomJoined event

Postby edisoni » 07 Jun 2018, 04:02

I trying send response after user connected to room, but event fired, and on client i`am not received, but others received.

Code: Select all

   
    public void userJoin(ISFSEvent isfsEvent) {
        try {
            User user = (User) isfsEvent.getParameter(SFSEventParam.USER);
            Room room = Helper.getCurrentRoom(this);
            if (room.getPlayersList().size() == 1) {
                start();
            }

            sfsApi.sendExtensionResponse("state", getStateMap(), user, room, false);
        } catch (Exception exp) {
            exp.printStackTrace();
        }
    }
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Not sended ExtensionResponse in OnRoomJoined event

Postby Lapo » 07 Jun 2018, 07:35

Hi,
maybe there is an error on server side and you didn't realize? I'd recommend to check the logs and make sure the code didn't cause any error.

Also you said that "others received" but the code you have posted only sends a response to the user who joined, so no one else will receive a response. What do you mean exactly by "others received"?

Finally I am not sure why you use this line:

Code: Select all

 Room room = Helper.getCurrentRoom(this);

Normally you can get the current Room with this:

Code: Select all

Room room = getParentExtension.getRoom();


Maybe your code is also correct. Just wondering why you needed a special Helper class for that...

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
edisoni
Posts: 2
Joined: 07 Jun 2018, 03:55

Re: Not sended ExtensionResponse in OnRoomJoined event

Postby edisoni » 07 Jun 2018, 07:59

Screen
Attachments
Screenshot_11.png
(100.44 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Not sended ExtensionResponse in OnRoomJoined event

Postby Lapo » 07 Jun 2018, 15:08

Thanks, but I meant checking the server side logs.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 62 guests