Network programming guide



Read Interaction Overview before this section.

The Immerse SDK sends messages from a user's local machine to other users via a relay server, hosted in the cloud. This server can also store messages, so that users joining sessions at different times will see a consistent, synchronised view of the environment.

Here we will mostly talk about considerations when programming network-enabled VR applications and discuss some of the tools provided by the Immerse SDK and platform.

The Immerse Platform enables people from different locations to collaborate together in the same session in VR



When the SDK initialises, it connects to the Immerse backend platform services and receives the current state of the scene. This can only take a few milliseconds, but also means care has to be taken when using Awake and Start Unity component methods to access SDK systems and components.

To access the Immerse SDK at startup, the following pattern is recommended:

private IEnumerator Start()
  yield return App.WaitForSdkReadyCoroutine(this);
  // It is now safe to access SDK components, like look up the local Avatar

A Coroutine is used, which waits for the SDK to be ready. Once this returns from waiting, the necessary components of the SDK can safely be accessed, knowing that they will be ready.

Asynchronous and consistent state changes

When networking is involved, be careful when making assumptions regarding the timing of events - this is particularly important when considering asynchronous events and consistency of state.

For instance, what happens when two people grab the same object at the same time? Or what happens when somebody drops an object and it rolls over the floor - what does everybody else see? In general, the Immerse messaging system is implemented to act on events when a message is received (most messages are sent to everyone, including the local user, which are broadcast back to themselves).

This is important because it allows the server to correctly order messages; they will be received in the same order as the server receives them (with latency differences minimised). This process means that everybody in a session will always receive messages ordered sequentially and thus provide a consistent state.


To solve the other issue that stems from multiple users interacting with the same object, the Immerse SDK is based around a concept of authority. Only one user can have authority of an interactable object at any time. The user with authority will be responsible for telling everyone else where the object is and its orientation. The user with authority will be in a sending state, and everybody else will be in a receiving state.

Further reading

For more information, read the Interaction Overview section. Synchronisation and interaction and Synchronising State between users also provide more details for making complicated interactions possible.

Updated 9 months ago

Network programming guide

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.