Server is a singleton. Server also has a list of the following that exist on this particular server:
- A set of Sessions with users
- A set of Rooms that users have visited - let's call these the "List of Rooms the Server is aware of"
Each user who logs on will create a their own session and this is added to the Server's set of Sessions. Each session keeps track of user specific information. This includes:
- The Server that the user's session belongs to
- A set of Rooms that the user has visited - let's call these the "List of Rooms the User is aware of"
When a user first contacts the server, they establish a connection to the server on a designated port. This triggers a connection event in the Server singleton.
The Server will establish a TCP socket connection with the client and try to read any information that is being sent down the socket to the Server. The first thing that the client should do is send a message to carry out a "Logon" - according to the API documentation. The Server carries out a few checks to make sure that this person has called the "Logon" method before calling any other methods and that they have the necessary information to logon.
The Server also checks to make sure that the client is not calling a method that is not supported.
Sample Messages from JanusVR Release 40.3
{"pos":"7.72222 0.069446 -7.72222","dir":"-1 -1.33e-06 9.42e-07","view_dir":"-1 -1.33e-06 9.42e-07","up_dir":"-1.33e-06 1 1.25e-12","head_pos":"0 0 0","avatar":"<FireBoxRoom><Assets><AssetObject id=^head^ src=^http://avatars.vrsites.com/chibii/head_male.obj^ mtl=^http://avatars.vrsites.com/chibii/mtls/head_male3.mtl^ /><AssetObject id=^body^ src=^http://avatars.vrsites.com/chibii/body_male.obj^ mtl=^http://avatars.vrsites.com/chibii/mtls/body_male3.mtl^ /></Assets><Room><Ghost id=^ProudMinna333^ js_id=^3^ scale=^1.700000 1.700000 1.700000^ head_id=^head^ head_pos=^0.000000 0.750000 0.000000^ body_id=^body^ /></Room></FireBoxRoom>"}
{"pos":"7.72222 -0.267704 -7.72222","dir":"-1 -1.33e-06 9.42e-07","view_dir":"-1 -1.33e-06 9.42e-07","up_dir":"-1.33e-06 1 1.25e-12","head_pos":"0 0 0"}
{"pos":"7.72222 -0.267704 -7.72222","dir":"-1 -1.33e-06 9.42e-07","view_dir":"-1 -1.33e-06 9.42e-07","up_dir":"-1.33e-06 1 1.25e-12","head_pos":"0 0 0"}
DEBUG: SESSION.LOGON -> {"userId":"ProudMinna333","version":"40.3","roomId":"e562b2e1339fc08d635d28481121857c"}
DEBUG: SESSION.SUBSCRIBE -> {"userId":"ProudMinna333","version":"40.3","roomId":"e562b2e1339fc08d635d28481121857c"}
DEBUG: SESSION.SUBSCRIBE -> {"roomId":"e562b2e1339fc08d635d28481121857c"}
DEBUG: SESSION.ENTER_ROOM -> {"roomId":"e562b2e1339fc08d635d28481121857c"}