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
coolboy714cp
Posts: 323
Joined: 06 Feb 2010, 02:45
Contact:

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
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Question about send() and sendExtensionResponse()

Postby Lapo » 03 Apr 2019, 13:49

Hi,
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.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Alexwek, Thomasea and 82 guests