MCPcopy
hub / github.com/feross/simple-peer / onMessage

Function onMessage

perf/send.js:21–35  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

19socket.addEventListener('message', onMessage)
20
21function onMessage (event) {
22 const message = event.data
23 if (message === 'ready') {
24 if (peer) return
25 peer = new Peer({ initiator: true })
26 peer.on('signal', function (signal) {
27 socket.send(JSON.stringify(signal))
28 })
29 peer.on('connect', function () {
30 endless.pipe(peer)
31 })
32 } else {
33 peer.signal(JSON.parse(message))
34 }
35}

Callers

nothing calls this directly

Calls 2

sendMethod · 0.45
signalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…