openfin-webrtc-client
v1.0.12
Published
WebRTC client
Downloads
3
Readme
client library for webrtc-signaling
Client libraryto add real-time communication capabilities with signaling service and WebRTC.
Build the project
- Install project dependencies.
npm i
- Build the project.
npm run build
Usage
- Install the module for your project.
npm install --save openfin-webrtc-client
- Import.
import { Configuration, PeerConnection } from 'openfin-webrtc-client';
- Create and initialize a PeerConnection.
const configuration: Configuration = {
signalingBaseUrl: 'https://webrtc-signaling-hostname',
pairingCode: 'webrtcExample', // both peers of a connection need to have the same pairingCode
};
const peerConnection:PeerConnection = new PeerConnection(configuration);
await peerConnection.initialize()
const peerChannel:PeerChannel = await peerConnection.createChannel('MyChannel');
// listen for messages sent by the remote peer
peerChannel.onMessage((data: String) => {
console.log(data);
});
// send data to the remote peer
peerChannel.send('Hello');
- Listen to event for channels created by the both peers.
peerConnection.onChannel((channel: PeerChannel) => {
if (channel.name !== 'MyChannel') {
channel.send('Hello Peer');
}
});
Next Steps and Known Issues
* Add configuration for the location of the:
* signaling server
* Documentation
* Automate the process to pair the machines:
* Currently a shared secret
* Ability to extend/remove a pairing (currently based on session)
* Determine client library packing/delivery (probably part of InterOp)
* Document the use cases we can support, associated test cases and QA