Class LocalOnlySignaler
Simple signaler using two peer connections in the same process, and hard-coding their SDP message delivery to avoid the need for any kind of networking to deliver SDP messages.
This component is designed to be used in demos where both peers are present in the same scene.
Inherited Members
Namespace: Microsoft.MixedReality.WebRTC.Unity
Assembly: cs.temp.dll.dll
Syntax
public class LocalOnlySignaler : WorkQueue
Fields
Peer1
First peer to connect, which will generate an offer.
Declaration
public PeerConnection Peer1
Field Value
Type | Description |
---|---|
PeerConnection |
Peer2
Second peer to connect, which will wait for an offer from the first peer.
Declaration
public PeerConnection Peer2
Field Value
Type | Description |
---|---|
PeerConnection |
Properties
IsConnected
Check if the last connection attempt successfully completed. This is reset to false
each
time StartConnection() is called, and is updated after WaitForConnection(Int32)
returned to indicate if the connection succeeded.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
StartConnection()
Initiate a connection by having Peer1 send an offer to Peer2, and wait until the SDP exchange completed. To wait for completion, use WaitForConnection(Int32) then check the value of IsConnected after that to determine if WaitForConnection(Int32) terminated due to the connection being established or if it timed out.
Declaration
public bool StartConnection()
Returns
Type | Description |
---|---|
Boolean |
|
WaitForConnection(Int32)
Wait for the connection being established.
Declaration
public IEnumerator WaitForConnection(int millisecondsTimeout)
Parameters
Type | Name | Description |
---|---|---|
Int32 | millisecondsTimeout | Timeout in milliseconds to wait for the connection. |
Returns
Type | Description |
---|---|
IEnumerator | An enumerator used to |
Examples
Assert.IsTrue(signaler.StartConnection()); yield return signaler.WaitForConnection(millisecondsTimeout: 10000); Assert.IsTrue(signaler.IsConnected);