3dtoolkit-signal 中文文档教程
3dtoolkit-signal
3dtoolkit webrtc 信号实现,使用 http
:satellite:
这使得 webrtc 对等通信能够跨3dtoolkit 服务器/客户端堆栈。 这意味着它可用于促进 N 个客户端、N 个对等点和/或两者之间的通信。 它使用 http
作为协议,也可以在 https
上运行。 此外,可以打开身份验证,要求客户端提供有效的 OAuth 2.0 令牌才能成功访问该服务。
此实现建立在以下组件之上:
- express
- webrtc-signal-http
- webrtc-signal-http-heartbeat
- webrtc-signal-http-capacity
- webrtc-signal-http-peer-identification
- passport
- passport-azure-ad
Getting started
此实现支持以下配置设置,通过环境变量控制:
PORT
- the port to start the server onWEBRTC_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 used
RESTful API
请参阅:
我们的 API 只是将这些 API 组合在一起,并增加了以下要求:
所有请求都必须具有有效的 授权:如果
标头。 请参阅 AzureAD 文档以了解如何获得一个。WEBRTC_AUTH_ENABLED
为 true
,则不记名
Docker
构建:docker build -t 3dtoolkit-signal .
运行:docker run --rm -it -p 3000:3000 3dtoolkit-signal
License
MIT
3dtoolkit-signal
3dtoolkit webrtc signal implementation, using http
:satellite:
This enables webrtc peer communication across the 3dtoolkit 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
- passport
- passport-azure-ad
Getting started
This implementation supports the following configuration settings, controlled via environment variables:
PORT
- the port to start the server onWEBRTC_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 used
RESTful API
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.
Docker
Building: docker build -t 3dtoolkit-signal .
Running: docker run --rm -it -p 3000:3000 3dtoolkit-signal
License
MIT
你可能也喜欢
- @0x/abi-gen 中文文档教程
- @11tyrocks/eleventy-plugin-social-images 中文文档教程
- @3test/ethereum-bitski-frontend-provider 中文文档教程
- @4geit/rct-event-list-component 中文文档教程
- @7r/eslint-config-7r-building 中文文档教程
- @9188/w-cli 中文文档教程
- @__path/graph 中文文档教程
- @a-ogilvie/eslint-config 中文文档教程
- @a6kme/math 中文文档教程
- @abi-software/flatmap-viewer 中文文档教程