3dtoolkit-signal 中文文档教程

发布于 6年前 浏览 29 更新于 3年前

3dtoolkit-signal

构建状态

部署到 Azure

3dtoolkit webrtc 信号实现,使用 http :satellite:

这使得 webrtc 对等通信能够跨3dtoolkit 服务器/客户端堆栈。 这意味着它可用于促进 N 个客户端、N 个对等点和/或两者之间的通信。 它使用 http 作为协议,也可以在 https 上运行。 此外,可以打开身份验证,要求客户端提供有效的 OAuth 2.0 令牌才能成功访问该服务。

此实现建立在以下组件之上:

Getting started

此实现支持以下配置设置,通过环境变量控制:

  • PORT - the port to start the server on
  • WEBRTC_SIGNAL_LOGGING - boolean flag indicating if bunyan logging should be enabled
  • WEBRTC_HEARTBEAT_ENABLED - boolean flag indicating if webrtc-signal-http-heartbeat should be enabled
  • WEBRTC_HEARTBEAT_MS - (requires heartbeat) number of ms after which a client is marked as stale and removed if they have not issued a GET /heartbeat
  • WEBRTC_HEARTBEAT_GC_MS - (requires heartbeat) number of ms at which the stale clients are "garbage collected" and removed
  • WEBRTC_AUTH_ENABLED - boolean flag indicating if passport-azure-ad should be enabled
  • WEBRTC_AUTH_B2C_APP_ID - Azure AD B2C application id. required if auth is enabled
  • WEBRTC_AUTH_B2C_TENANT_ID - Azure AD B2C tenant id. required if auth is enabled
  • WEBRTC_AUTH_B2C_POLICY_NAME - Azure AD B2C policy name. likely b2c_1_signup. required if auth is enabled
  • WEBRTC_AUTH_APP_ID - Azure AD application id. required if auth is enabled
  • WEBRTC_AUTH_TENANT_ID - Azure AD tenant id. required if auth is enabled
  • WEBRTC_CAPACITY_ENABLED - boolean flag indicating if webrtc-signal-http-capacity should be enabled
  • WEBRTC_RECOGNITION_ENABLED - boolean flag indicating if webrtc-signal-http-peer-identification should be enabled
  • WEBRTC_PEERID_RESPECT_CAPACITY - hands out peers such that capacity reported by the webrtc-signal-http-capacity plugin is respected
  • WEBRTC_PEERID_PAIRING - pairs clients to servers. if WEBRTC_PEERID_RESPECT_CAPACITY is set, capacity will be considered, otherwise 1:1 pairings will be used

RESTful API

请参阅:

我们的 API 只是将这些 API 组合在一起,并增加了以下要求:

所有请求都必须具有有效的 授权:如果 WEBRTC_AUTH_ENABLEDtrue,则不记名 标头。 请参阅 AzureAD 文档以了解如何获得一个。

Docker

构建:docker build -t 3dtoolkit-signal . 运行:docker run --rm -it -p 3000:3000 3dtoolkit-signal

License

MIT

3dtoolkit-signal

Build Status

Deploy to Azure

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:

Getting started

This implementation supports the following configuration settings, controlled via environment variables:

  • PORT - the port to start the server on
  • WEBRTC_SIGNAL_LOGGING - boolean flag indicating if bunyan logging should be enabled
  • WEBRTC_HEARTBEAT_ENABLED - boolean flag indicating if webrtc-signal-http-heartbeat should be enabled
  • WEBRTC_HEARTBEAT_MS - (requires heartbeat) number of ms after which a client is marked as stale and removed if they have not issued a GET /heartbeat
  • WEBRTC_HEARTBEAT_GC_MS - (requires heartbeat) number of ms at which the stale clients are "garbage collected" and removed
  • WEBRTC_AUTH_ENABLED - boolean flag indicating if passport-azure-ad should be enabled
  • WEBRTC_AUTH_B2C_APP_ID - Azure AD B2C application id. required if auth is enabled
  • WEBRTC_AUTH_B2C_TENANT_ID - Azure AD B2C tenant id. required if auth is enabled
  • WEBRTC_AUTH_B2C_POLICY_NAME - Azure AD B2C policy name. likely b2c_1_signup. required if auth is enabled
  • WEBRTC_AUTH_APP_ID - Azure AD application id. required if auth is enabled
  • WEBRTC_AUTH_TENANT_ID - Azure AD tenant id. required if auth is enabled
  • WEBRTC_CAPACITY_ENABLED - boolean flag indicating if webrtc-signal-http-capacity should be enabled
  • WEBRTC_RECOGNITION_ENABLED - boolean flag indicating if webrtc-signal-http-peer-identification should be enabled
  • WEBRTC_PEERID_RESPECT_CAPACITY - hands out peers such that capacity reported by the webrtc-signal-http-capacity plugin is respected
  • WEBRTC_PEERID_PAIRING - pairs clients to servers. if WEBRTC_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

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文