Socket
Book a DemoInstallSign in
Socket

@ark-org/simple-peer-connector

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ark-org/simple-peer-connector

# API

npmnpm
Version
0.0.3
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

@ark-org/simple-peer-connector

API

SendPeer

构造参数 config

  • iceServers turn或stun服务器配置项

  • server websocket服务器地址

  • onConnected: (remoteStream, localStream) : void => {} 连接成功后的回调函数

  • onHangup: () : void => {} 产生挂机行为后的回调函数

.connect(localStream): void

发起连接行为

.hangup(): void

发起挂机行为,并断开连接

ReceivePeer

构造参数 config

  • iceServers turn或stun服务器配置项

  • server websocket服务器地址

  • onConnected: (remoteStream, localStream) : void => {} 连接成功后的回调函数

  • onHangup: () : void => {} 产生挂机行为后的回调函数

.connect(localStream): void

发起连接行为

.hangup(): void

发起挂机行为,并断开连接

MultiplePeer

构造参数 config

  • iceServers turn或stun服务器配置项

  • server websocket服务器地址

  • onJoin: (peerId, remoteStream, localStream, peers) : void => {} 当有其他用户加入时的回调函数

  • onRemove: (peerId, peers) : void => {} 当有其他用户离开时的回调函数

  • onDisconnected: (peers) : void => {} 当前用户断开后的回调函数

.connect(roomId, localStream): void

发起连接行为

.disconnect(): void

发起挂机行为,并断开连接

FAQs

Package last updated on 22 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts