Skip to content

Instantly share code, notes, and snippets.

View SaifRehman's full-sized avatar
🎯
Focusing

SaifRehman SaifRehman

🎯
Focusing
  • IBM
  • Dubai
View GitHub Profile
// This is a bare bones example of creating a data channel between two WebRTC
// peers. Let's imagine two peers trying to connect to each other. We'll call
// one the "offer peer", and the other the "answer peer". The offer peer will
// be the one initiating a connection, and the answer peer will be the one
// responding to it.
//
// The two peers must use a separate connection to negotiate their connection.
// A websocket connection to a shared server is often used for this negotiation.
// They will exchange offers and answers using the websocket. Each peer will
// also attempt to discover more details about themselves (ICE), such as their