B4J Question WebSocket know what device have disconnected

Douglas Farias

Licensed User
Longtime User
i m using this
to make a game server to my real time game, for now when i connect to the server i send phone infos, like phone id, android id etc....

i need to know if this websocket have a id info on the server, because i go make a routine check and if the user log out of the game i need remove this player from the map.

but how to know what player (device) have disconnected?
Have a way to put a log on this server example?

for example, i connect now with my phone, the server make log conected user = 1
now i connect with my table, the server make log connected user = 2

now i disconect my phone , game server show disconected user = 1

how can i make this logs? its possible?

on the server sample show only disconnected
Private Sub WebSocket_Disconnected

    timer1.Enabled = False
End Sub
dont show what device as disconected


Douglas Farias

Licensed User
Longtime User
this https://www.b4x.com/android/forum/threads/jwebsocketclient-library.40985/ ??
i take a look, and this save only the device id, this i m already make here.

but the solution is only check with a timer if the device stay connected?

i have talk with my friend, he is c# programmer and he say me

"if u do with sockets then u have a dc/log out function already
[29/01/2015 22:45:56] HateMe (◕ _ ◕): bc u need to clear the socket"

on the websocket dont have a option to see connected ids?
like 0 to infinity

if i connect now (first player) log connected player = 0
if another player connect show = connected player = 1


if one player disconnect or have connetion lost, show log disconnected = 0

what the simple way to catch the devices connected and when disconnected ?
Upvote 0

Douglas Farias

Licensed User
Longtime User
i have made a check on gameserver with a timer to move the character, its working now thx
Upvote 0