Question about send() and sendExtensionResponse()

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

Moderators: Lapo, Bax

User avatar
Posts: 323
Joined: 06 Feb 2010, 02:45

Question about send() and sendExtensionResponse()

Postby coolboy714cp » 03 Apr 2019, 11:37

Hello everyone, I was just in the middle of coding and noticed that there are two different methods that can be used to send a response back to the client after you first send an extension request.

You can use simply send():

Code: Select all

send(responseCmd, response, responseUser);

And then you can also use getApi().sendExtensionResponse():

Code: Select all

getApi().sendExtensionResponse(responseCmd, response, responseUser, responseRoom, responseUDP);

Why are there two different methods that can do the same thing? Or am I wrong here and they have two different purposes? (Now thinking about it, I believe send() is for things like servlets maybe, but I'm not 100% sure.)

So when should each one of those methods be used?

Thanks for any help and advice!
-Carson Bennett
User avatar
Site Admin
Posts: 22073
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Question about send() and sendExtensionResponse()

Postby Lapo » 03 Apr 2019, 13:49

one is the short version of the longer one, a common practice in Java or any other language that supports method overloading.

The responseRoom parameter is necessary when you're replying from a Room Extension and you need the client to be able to identify which Room is the response coming from.

The last parameter is set to false by default but you can pass it if you want the response to be sent by UDP.

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 36 guests