Hololight Stream for Unity advanced - Signaling
In order to establish a connection between two remote peers, they need to first exchange connection information. This process is called signaling. For more information, check out this page on WebRTC signaling.
Developers can provide their own signaling implementation to use in Hololight Stream in order to establish a connection with a remote peer. You might require custom signaling when using advanced connectivity functionality, complicated network environments, or when there are specific demands like security or encryption to exchange specific information before establishing a proper streaming connection. In most other cases going with the default implementation should be fine. There is an example implementation in the "com.hololight.stream.examples/Samples/Signaling directory". If there isn’t any signaling implementation provided, Hololight Stream will use the internal signaling implementation.
Signaling base class
A custom signaling implementation must inherit from the abstract base class "Signaling.cs".
Method |
Description |
Start |
Called when the signaling process starts. |
Stop |
Called when the signaling process stops. This happens either when a connection is established or when the application has been closed. |
ConnectionChanged |
Called when the Hololight Stream connection state changes.Using this callback is at the discretion of the implementor. |
SendSdp |
Call when the SDP string is sent to the remote end. |
SendIceCandidate |
Called when the ICE candidate information is sent to the remote end. |
The following can be called by the implementing class:
Method |
Description |
SetConnectionState |
Notifies Hololight Stream about the signaling connection state. When called with a true connection state, Hololight Stream will asynchronously call SendSdp and SendIceCandidate to pass information to the remote endpoint. In situations where the implementor wants to carry out additional information exchange prior to Hololight Stream’s information, this call can be delayed until the exchange is complete. |
SetRemoteSdp |
Notifies Hololight Stream about the obtained remote SDP. |
SetRemoteIceCandidate |
Notifies Hololight Stream about an obtained remote ICE candidate. |
In the XR Project Settings, you can specify the signaling implementation Hololight Stream uses.
The implementation must be passed with the full path, including the namespace, to allow construction via System.Reflection.
The implementation is constructed and owned by the Hololight Stream XR Loader, IsarXRLoader class. A property, Signaling, is exposed by the loader which exposes the constructed object. This can be used to directly interface with the implementation specified within the settings file. For more information regarding the XR Loader and how to access it, see XRManagerSettings.
Example Unity server signaling
This example uses a simple TCP server which listens to a client on any local IP address. It sends the Hololight Stream information in XML format and prepends each message with the length of the XML string in big-endian format. This implementation can only be used with the default client signaling implementations provided.
| To specify the Hololight Stream Sample Signaling, enter "Hololight.Stream.Example.SampleServerSignaling, Hololight.Stream.Examples.Signaling" in the Signaling Implementation Type box. |
The source code of this example can be found at com.hololight.stream/Runtime/Signaling/SampleServerSignaling.cs.