Immersitech SDK Documentation
Engage SDK documentation
|
To use the Event Manager Websocket library you only need to follow very simple steps. On the server side, first make sure you have a valid websocket configuration file and it is pointed to properly by imm_initialize_library. Seconly simply call the following function to start up the websocket server:
The server will run perpetually allowing clients to connect, send, and receive messages until you call the following function to stop it:
And that is it! The server will take care of the rest.
When first call imm_initialize_library, you provide a path to your websocket configuration file, imm_websocket_config.json
. In this file, there are several parameter you can edit that will allow the server to work under your preferences and utilize your specific keys to ensure a secure connection.
There are 5 different options for certificates you can provide. You do not need to provide all or any of them, only the ones you want to use. If you do not want to use an option, just provide "none"
in the field. The two authentication fields can be any key-value pair that you desire to require in your custom handshake header.
Now to learn how to interact with the server using a web client, proceed to the next section.
If there is an Event Manager Websocket server running somewhere, you can now connect to it to send and receive events. Let us see how to do so.
In order to connect your client to event manager, you must follow a few steps. First you should use the standard websocket connection method of calling wss://example.com:9002
where you replace example.com with the IP address to your server and 9002 with the port number you specified in the websocket-config file on the server. The event manager always utilizes TLS security, so ensure your provided keys are correct and match for the server and client. In order for event manager to authorize any client, it requires that a special key is added to the websocket handshake header. This ensures the safety of all incoming connections. You will need to add the following to your header: "Immersitech": "I_am_valid_immersitech_please_accept_me"
(or whichever values you set for authentification_key and authentification_value). At any given point while trying to establish a connection, watch your terminal on the server for helpful debugging messages.
For a client to make a request, they must simply create a JSON message and pass it to the websocket server.
When the server receives your request, it will be processed and a JSON response with the following key-value pairs will be returned to you:
Note that if you receive "Status": "OK"
, then you will not see a key-value pair for "Error Description"
in your response JSON. Additionally, you will only receive "Value"
or other key-value pairs if your original request was asking for a value. Your request may provide additional output parameters if they are relevant, and would be described in the full API below.
Sometimes a host program may perform actions without the request of a client. In this case, the server will want to keep the client up to date by sending a message to the client about an event that occurred. If an event occurred, you will see a JSON formatted message with the following key-value pairs:
To see a full list of events that may be triggered, view imm_event_type
The custom event command will take any message you provide and broadcast it to all connected clients. This can be useful for you to put additional functionality into your application with adding a different messaging system.
Note that anything else in additional to what is described about is also broadcast with the JSON. So feel free to add your custom message as a JSON packet, a string, or anything you'd like.
The get version function will return the versions of the Immersitech Library.
A successful response will be formatted as follows:
The get license info function will return detailed information about your license key in JSON format.
An Example Response would be:
This command will return information about the current library configuration.
Returned parameters will include:
This command will return a JSON packet detailing all the available room layouts.
The response will be an exact replica of your provided room layout json file. Reference your room layout json file for the format of the response.
This command will return the id of the layout a given room is current using. This integer id can be related to the list of room layouts found with get_json_all_room_layouts
The response will contain the following parameters
This command will return the number of rooms that currently existing
The response will contain the following parameters
This command will return the number of participants that are currently in a given room
The response will contain the following parameters
You can retrieve the current position of a participant with:
The response to this message will contain the following parameters:
You can change the x, y, z position of a particular participant using the following. You also must include a heading to manually set the direction they will be facing.
This command will move a participant to a new seat that you specify. The return message will include the position and heading of the new seat. Recall that seats are 1 indexed from the array in the room layout.
The response to this command will include the following parameters:
This command will get information about a participant's current seat
The response to this command will include the following parameters:
This command will change the layout of a room. This means the participants in the room will likely be re-positioned. Recall that layouts are 1 indexed from the "room_list" in the room layout file.
This command will get the name of a given participant.
The response will contain the following parameters
You can use this command to change the display name of a participant in the call, real time:
This command will get information about the way a participant was configured.
The response to this command will include the following parameters:
This command will set the state of every participant in a room. Please view imm_audio_control for a list of all available controls you can adjust, including their allowed ranges and defaults.
Example command to turn noise cancellation on:
This command will find the state of an audio control for a single participant.
Please view imm_audio_control for a list of all available controls you can adjust, including their allowed ranges and defaults.
The response will contain the following parameters
The command will set the state of an audio control for a single participant.
Please view imm_audio_control for a list of all available controls you can adjust, including their allowed ranges and defaults.
Example command to turn noise cancellation on:
This command will get the angle from one participant to another in spherical coordinates. The coordinates represent the direction the listener participant hears the source participant.
The response to this command will have the following parameters:
This command allows you to add a demo participant into a room. Audio files can later be played through this demo participant and be rendered in 3D. Note that demo participants may only have an ID that is a negative integer to protect from confusing demo participants and real ones.
If you want to later remove a demo participant, you can use the following syntax. Be careful not to use the ID of a real participant, as it will remove them instead and likely break your application.
This function is used to play audio through a demo participant. Be careful not to accidentally send the ID of a real participant, as it will play the audio through them instead.
If you want to stop playback of a file you read into a particular demo participant, you can use the following: