/// import { EventEmitter } from 'events'; /** * @module rtc */ /** * A wrapper for RTCDataChannel. Used to transfer custom data between peers. * @class rtc.DataChannel * * @constructor * @param {RTCDataChannel} channel The wrapped native data channel * @param {Number} [max_buffer] The size of the send buffer after which we will delay sending */ export declare class DataChannel extends EventEmitter { channel: RTCDataChannel; max_buffer: number; _connected: boolean; _connect_queue: Array; _send_buffer: Array; /** * A new messages was received. Triggers only after `connect()` was called * @event message * @param {ArrayBuffer} data The data received */ /** * The channel was closed * @event closed */ constructor(channel: RTCDataChannel, max_buffer?: number); /** * Connect to the DataChannel. You will receive messages and will be able to send after calling this. * @method connect * @return {Promise} Promise which resolves as soon as the DataChannel is open */ connect(): Promise; close(): Promise; /** * The label of the DataChannel used to distinguish multiple channels * @method label * @return {String} The label */ label(): string; /** * Send data to the peer through the DataChannel * @method send * @param data The data to be transferred * @return {Promise} Promise which will be resolved when the data was passed to the native data channel */ send(data: any): Promise; /** * Method which actually sends the data. Implements buffering * @method _actualSend * @private */ private actualSend; }