This sample shows how to setup a datachannel connection between two peers in different tabs using RTCPeerConnection and Broadcast Channel
Open the sample in two tabs (of the same browser), then click start in the first tab and send messages back and forth.
For more information about RTCDataChannel, see Getting Started With WebRTC.
View source on GitHub