example/direct/static/index.js
function handleStream(remotePeerId, stream) {
    if (opened[remotePeerId] !== true) {
        stream.write("hello!")

        stream.on("data", log)
    }

    function log(data) {
        console.log("[PEER2]", remotePeerId, data)
    }
}
function handleStream(remotePeerId, stream) {
    if (opened[remotePeerId] !== true) {
        stream.write("hello!")

        stream.on("data", log)
    }

    function log(data) {
        console.log("[PEER2]", remotePeerId, data)
    }
}
function handleStream ( remotePeerId , stream ) { if ( opened [ remotePeerId ] !== true ) { stream . write ( "hello!" ) stream . on ( "data" , log ) } function log ( data ) { console . log ( "[PEER2]" , remotePeerId , data ) } }
When the relay emits a stream handle it
When the relay emits a stream handle it