I have noticed if I create a webrtc data channel before creating and sending a local description (SDP) to a remote, then datachannel
event is fired on the remote.
If I create the channel when webrtc-connection is established then the datachannel
event isn't fired on the remote.
Why does this happen? Is it really impossible to create the data channel, "attaching" it to a existing webrtc connection?
If you do not create a data channel before negotiating. the datachannel protocol will not be negotiated in the SDP and you need to renegotiate using another round of createOffer/setLocalDescription/setRemoteDescription. You will also notice the "negotiationneeded" event firing on the peerconnection.