How to use the wrtc.DataChannel function in wrtc

To help you get started, we’ve selected a few wrtc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github boplish / core / js / adapter.js View on Github external
if (that.iceGatheringState === 'complete') {
                    var nullCandidate = new RTCIceCandidate();
                    nullCandidate.candidate = null;
                    that.onicecandidate(nullCandidate);
                } else {
                    checkIceState();
                }
            }, 1000).unref();
        })(); // miserable hack, waiting for https://github.com/js-platform/node-webrtc/issues/44
    };
    util.inherits(RTCPeerConnection, webrtc.RTCPeerConnection);

    GLOBAL.RTCPeerConnection = RTCPeerConnection;
    GLOBAL.RTCIceCandidate = webrtc.RTCIceCandidate;
    GLOBAL.RTCSessionDescription = webrtc.RTCSessionDescription;
    GLOBAL.DataChannel = webrtc.DataChannel;

    var CustomWebSocket = function(url) {
        if (!(this instanceof WebSocket)) {
            return new CustomWebSocket(url);
        }
        var websocketClient = new WebSocketClient();
        var that = this;
        websocketClient.on('connect', function(connection) {
            connection.on('message', function(msg) {
                msg.data = msg.utf8Data;
                that.onmessage(msg);
            });
            that.send = function(msg) {
                connection.send(msg);
            };
        });

wrtc

Standards-compliant WebRTC implementation for Node

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

60 / 100
Full package analysis