diff --git a/src/peer/index.ts b/src/peer/index.ts index d5d40e3..cac1141 100644 --- a/src/peer/index.ts +++ b/src/peer/index.ts @@ -179,6 +179,15 @@ export default class RondevuPeer extends EventEmitter { return this.pc.addTrack(track, ...streams); } + /** + * Create a data channel for sending and receiving arbitrary data + * This should typically be called by the offerer before creating the offer + * The answerer will receive the channel via the 'datachannel' event + */ + createDataChannel(label: string, options?: RTCDataChannelInit): RTCDataChannel { + return this.pc.createDataChannel(label, options); + } + /** * Close the connection and clean up */