Saturday, 13 June 2020

How do i use WebRTC in node without the browser or any HTML?

​I'm trying to make a chat application for the terminal (terminal to terminal chat app) and works wothout the need of a browser and hence any HTML. I'm using wrtc module. But there is an error while creating data channel :return this._pc.createDataChannel.apply(this._pc, arguments);^DOMException [InvalidStateError]: Failed to execute 'createDataChannel' on 'RTCPeerConnection': The RTCPeerConnection's signalingState is 'closed'.The code segment is :myConnection = new wrtc.RTCPeerConnection(configuration, {//optional: [{RtpDataChannels: true}]});console.log("RTCPeerConnection object was created");console.log(myConnection);//setup ice handling//when the browser finds an ice candidate we send it to another peermyConnection.onicecandidate = function (event) {console.log("Ice candidates found");if (event.candidate) {send({type: "candidate",candidate: event.candidate});}};dataChannel = myConnection.createDataChannel("myDataChannel", dataChannelOptions);What's wrong and how to get rid of the error? WebRTC can work in node.js without the browser, right?

Submitted June 13, 2020 at 09:46AM by DeusExMachina24

No comments:

Post a Comment