Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility simple-peer #347

Open
temaivanoff opened this issue Oct 27, 2023 · 2 comments
Open

Compatibility simple-peer #347

temaivanoff opened this issue Oct 27, 2023 · 2 comments

Comments

@temaivanoff
Copy link

https://github.com/feross/simple-peer

@shinyoshiaki
Copy link
Owner

?

@temaivanoff
Copy link
Author

temaivanoff commented Oct 27, 2023

concise, node.js style API for WebRTC

var Peer = require('simple-peer')
var wrtc = require('wrtc') // node-webrtc, werift-webrtc ???

var peer1 = new Peer({ initiator: true, wrtc: wrtc })
var peer2 = new Peer({ wrtc: wrtc })

peer1.on('signal', data => {
  // when peer1 has signaling data, give it to peer2 somehow
  peer2.signal(data)
})

peer2.on('signal', data => {
  // when peer2 has signaling data, give it to peer1 somehow
  peer1.signal(data)
})

peer1.on('connect', () => {
  // wait for 'connect' event before using the data channel
  peer1.send('hey peer2, how is it going?')
})

peer2.on('data', data => {
  // got a data channel message
  console.log('got a message from peer1: ' + data)
})
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants