Skip to content

Instantly share code, notes, and snippets.

@oculushut
Last active August 29, 2015 14:19
Show Gist options
  • Save oculushut/61e62a5a8406b99e4d03 to your computer and use it in GitHub Desktop.
Save oculushut/61e62a5a8406b99e4d03 to your computer and use it in GitHub Desktop.
Janus VR Server Notes

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

MOVE

{"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"}

LOGON

DEBUG: SESSION.LOGON -> {"userId":"ProudMinna333","version":"40.3","roomId":"e562b2e1339fc08d635d28481121857c"}

SUBSCRIBE

DEBUG: SESSION.SUBSCRIBE -> {"userId":"ProudMinna333","version":"40.3","roomId":"e562b2e1339fc08d635d28481121857c"}
DEBUG: SESSION.SUBSCRIBE -> {"roomId":"e562b2e1339fc08d635d28481121857c"}

ENTER_ROOM

DEBUG: SESSION.ENTER_ROOM -> {"roomId":"e562b2e1339fc08d635d28481121857c"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment