3DStreamingToolkit webrtc signal implementation, using http
📡
This enables webrtc peer communication across the 3DStreamingToolkit server/client stack. This means that it can be used to faciliate communication between N clients, N peers, and/or both. It uses http
as a protocol, and can run over https
as well. Further, authentication can be toggled on, requiring clients to provide valid OAuth 2.0 tokens in order to successfully access the service.
This implementation is built on top of the following components:
- express
- webrtc-signal-http
- webrtc-signal-http-heartbeat
- webrtc-signal-http-capacity
- webrtc-signal-http-peer-identification
- webrtc-signal-http-publisher
- passport
- passport-azure-ad
This implementation supports the following configuration settings, controlled via environment variables:
PORT
- the port to start the server onWEBRTC_CORS
- boolean flag indicating if cors should allow wildcard access, or no cors headers. By default, no cors headers are presentWEBRTC_SIGNAL_LOGGING
- boolean flag indicating if bunyan logging should be enabledWEBRTC_HEARTBEAT_ENABLED
- boolean flag indicating if webrtc-signal-http-heartbeat should be enabledWEBRTC_HEARTBEAT_MS
- (requires heartbeat) number ofms
after which a client is marked as stale and removed if they have not issued aGET /heartbeat
WEBRTC_HEARTBEAT_GC_MS
- (requires heartbeat) number ofms
at which the stale clients are "garbage collected" and removedWEBRTC_AUTH_ENABLED
- boolean flag indicating if passport-azure-ad should be enabledWEBRTC_AUTH_B2C_APP_ID
- Azure AD B2C application id. required if auth is enabledWEBRTC_AUTH_B2C_TENANT_ID
- Azure AD B2C tenant id. required if auth is enabledWEBRTC_AUTH_B2C_POLICY_NAME
- Azure AD B2C policy name. likelyb2c_1_signup
. required if auth is enabledWEBRTC_AUTH_APP_ID
- Azure AD application id. required if auth is enabledWEBRTC_AUTH_TENANT_ID
- Azure AD tenant id. required if auth is enabledWEBRTC_CAPACITY_ENABLED
- boolean flag indicating if webrtc-signal-http-capacity should be enabledWEBRTC_RECOGNITION_ENABLED
- boolean flag indicating if webrtc-signal-http-peer-identification should be enabledWEBRTC_PEERID_RESPECT_CAPACITY
- hands out peers such that capacity reported by the webrtc-signal-http-capacity plugin is respectedWEBRTC_PEERID_PAIRING
- pairs clients to servers. ifWEBRTC_PEERID_RESPECT_CAPACITY
is set, capacity will be considered, otherwise 1:1 pairings will be usedWEBRTC_PUBLISH_STATE
- boolean flag indicating if webrtc-signal-http-publisher should be enabledWEBRTC_PUBLISH_URI
- uri to publish state of the world as-per webrtc-signal-http-publisherWEBRTC_TRUST_PROXY
- boolean flag indicating that the proxy should be trusted, and the 'x-forwarded-for' header should be used to discover ip. If you need ip data, and are on Azure, you need this.
See:
Our API is simply those APIs combined, with this added requirement:
All requests must have a valid Authorization: Bearer <token>
header if WEBRTC_AUTH_ENABLED
is true
. See the AzureAD docs to learn how to acquire one.
Building: docker build -t 3dtoolkit-signal .
Running: docker run --rm -it -p 3000:3000 3dtoolkit-signal
Building: npm run build
Running: npm run start
MIT