Responses binding for AuthenticatedConnectResponse
D
Davendra Jayasingam
started a topic
over 7 years ago
I know we don't have it in the responses binding, but is there a workaround? I need to do some stuff everytime a user reconnects to the game using AuthenticatedConnectRequest.
Best Answer
T
Tech Support
said
over 7 years ago
Ah, you want to know when a player connects on the server?
If so, there is a script executed when a player connects. It's in System -> Player Connected
You can bind and Action<string> to the authenticated event, this will be fired once AuthenticatedConnectRequest completes and the session is authenticated
GS.GameSparksAuthenticated = (playerId) => {
//Your code here
};
Gabriel
D
Davendra Jayasingam
said
over 7 years ago
There's no server side workaround is there?
Tech Support
said
over 7 years ago
Answer
Ah, you want to know when a player connects on the server?
If so, there is a script executed when a player connects. It's in System -> Player Connected
D
Davendra Jayasingam
said
over 7 years ago
Cool. Did not know it was there. Thank you.
E
Elizabeth Parent
said
about 7 years ago
Hi,
I use System -> Player connected to add my player to a table. I would like to remove this player when it disconnects. I try to use System -> Player disconnected, but I don't know how to test it.
Customer Support
said
about 7 years ago
Hi Elizabeth,
You can do this a few ways, you could send an EndSessionRequest in the Test Harness which when sent would execute whatever code is located in PlayerDisconnected. You can also disconnect a player in Cloud Code which you can read about here. Probably the best way to test it would be to create an event called something like "testPlayerDisconnected", pop any code you want to run when a player disconnects in there and run it manually from the Test Harness, the advantage here is that the debugger will pop up and step through your code so you can spot any problems easily, once it's all working and you're happy with it you can place it in the PlayerDisconnect System Script. If you have anymore questions just let me know.
Thanks,
Liam
B
Baris Tumerkan
said
about 7 years ago
Hi Liam,
Does the server wait for the Player Connected script to finish running before sending the AuthenticatedConnectResponse to the client?
Also, when does the Player Disconnected script run - after EndSessionRequest is sent, and after a period of inactivity?
Customer Support
said
about 7 years ago
Hi Baris.
Yes, the server waits player connected script to finish.
Player Disconnected only runs when the player actually disconnects the socket it doesn’t run with EndSessionRequest.
Davendra Jayasingam
I know we don't have it in the responses binding, but is there a workaround? I need to do some stuff everytime a user reconnects to the game using AuthenticatedConnectRequest.
Ah, you want to know when a player connects on the server?
If so, there is a script executed when a player connects. It's in System -> Player Connected
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
You can bind and Action<string> to the authenticated event, this will be fired once AuthenticatedConnectRequest completes and the session is authenticated
GS.GameSparksAuthenticated = (playerId) => {
//Your code here
};
Gabriel
Davendra Jayasingam
Tech Support
Ah, you want to know when a player connects on the server?
If so, there is a script executed when a player connects. It's in System -> Player Connected
Davendra Jayasingam
Elizabeth Parent
Hi,
I use System -> Player connected to add my player to a table. I would like to remove this player when it disconnects. I try to use System -> Player disconnected, but I don't know how to test it.
Customer Support
Hi Elizabeth,
You can do this a few ways, you could send an EndSessionRequest in the Test Harness which when sent would execute whatever code is located in PlayerDisconnected. You can also disconnect a player in Cloud Code which you can read about here. Probably the best way to test it would be to create an event called something like "testPlayerDisconnected", pop any code you want to run when a player disconnects in there and run it manually from the Test Harness, the advantage here is that the debugger will pop up and step through your code so you can spot any problems easily, once it's all working and you're happy with it you can place it in the PlayerDisconnect System Script. If you have anymore questions just let me know.
Thanks,
Liam
Baris Tumerkan
Hi Liam,
Does the server wait for the Player Connected script to finish running before sending the AuthenticatedConnectResponse to the client?
Also, when does the Player Disconnected script run - after EndSessionRequest is sent, and after a period of inactivity?
Customer Support
Hi Baris.
Yes, the server waits player connected script to finish.
Player Disconnected only runs when the player actually disconnects the socket it doesn’t run with EndSessionRequest.
Regards, Patrick.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics