Home Manual Reference Source Repository
import WebRTCService from 'netflux/src/service/WebRTCService.js'
public class | source

WebRTCService

Extends:

service/Service~Service → WebRTCService

Service class responsible to establish connections between peers via RTCDataChannel.

Constructor Summary

Public Constructor
public

constructor(id: number, iceServers: RTCIceServer)

Method Summary

Public Methods
public

connectOverSignaling(ws: type, key: type): type

public

Establishes an RTCDataChannel with a peer identified by id trough WebChannel.

public
public

onMessage(channel: Channel, senderId: number, recepientId: number, msg: Object)

Public Constructors

public constructor(id: number, iceServers: RTCIceServer) source

Params:

NameTypeAttributeDescription
id number

Service identifier

iceServers RTCIceServer

WebRTC configuration object

Public Methods

public connectOverSignaling(ws: type, key: type): type source

Params:

NameTypeAttributeDescription
ws type
key type

Description

Return:

type

Description

public connectOverWebChannel(wc: WebChannel, id: number): Promise<RTCDataChannel, string> source

Establishes an RTCDataChannel with a peer identified by id trough WebChannel.

Params:

NameTypeAttributeDescription
wc WebChannel
id number

public listenFromSignaling(ws: WebSocket, onChannel: function(channel: RTCDataChannel)) source

Params:

NameTypeAttributeDescription
ws WebSocket
onChannel function(channel: RTCDataChannel)

public onMessage(channel: Channel, senderId: number, recepientId: number, msg: Object) source

Params:

NameTypeAttributeDescription
channel Channel
senderId number
recepientId number
msg Object