Websocket Map


Login

Edit section 
Login:{
   "username":"websockuser",
   "password":"wspass",
   "sessionID":123456,
   "sessionKick": false
   }
 

sessionID is a uint32 random number, that that gets generated only once when a user goes to the map site.  The same number is resued with every login attempt.  If the server gets sent a different number, along with the same username, then it knows the login attempt is from another client/computer.  This makes it possible to limit one client, per username to log in. However, this could be problematic if the user has forgotten to log out, and has attempted to connect from somewhere else. You can force the original connection to disconnect, by using "sessionKick"

"sessionKick" will normally be set to false, unless the user has specifically requested the existing connection can be terminated.

 

loginReply:{
   "loggedIn": false,
   "message":"Client logged in elsewhere",
   "dupeLogin":true,
   }

Note: You can receive this message at any time, not just at login. Should that happen, another client has logged in, so return to the login dialouge.

 

Any other login failure looks like this:

 

loginReply:{
   "loggedIn": false,
   "message":"Invalid Username/Password",
   }

 

A sucessfull login:

loginReply:{
   "loggedIn": true,
   "clientID":5123456,
   "minActivitySecs:60,
   }

 

minActivitySecs  is the number of seconds you must send a message to the server, even if it's blank. Failure to do so will result in the socket being disconnected.

clientID is an optional uint64 number for reference.

 

TODO 

If connection is lost, the map will immediatly retry using the previously used username & password, with sessionKick = False.   It will keep retrying every few seconds until you get a loginReply.  If  loggedIn:False is returned, then it will stop retrying, and display the user login dialouge box.

If there are multiple websocket URL's.  Rotate the URLs, so that if one is down, another is found.