Open golgetahir opened 2 years ago
Hi all
What is going on here is that, before the datachannel closes, the peers leaves the stream. In that case datachannel thinks the stream is still live and tries to send some data ( not important since you already left the stream, just ping like data ) and this error is logged since the stream is ended. You can just ignore this exception or close the data channel earlier while leaving such as;
Change following function in webrtc_adaptor.js (link: https://github.com/ant-media/StreamApp/blob/master/src/main/webapp/js/webrtc_adaptor.js#L605)
leaveFromRoom(roomName, streamId)
{
this.roomName = roomName;
var jsCmd = {
command : "leaveFromRoom",
room: roomName,
};
console.log ("leave request is sent for "+ roomName);
if (this.remotePeerConnection[streamId].dataChannel != null) {
this.remotePeerConnection[streamId].dataChannel.close();
}
this.webSocketAdaptor.send(JSON.stringify(jsCmd));
}
Thanks
Short description
Datachannel sends error when you leave the room while it is enabled to send a notification.
Environment
Steps to reproduce
Expected behavior
Not to get an error from datachannel.
Actual behavior
This error is logged:
Data Channel Error: RTCErrorEvent {isTrusted: true, error: RTCError: Transport channel closed, type: 'error', target: RTCDataChannel, currentTarget: RTCDataChannel, …}