You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
noise-network returns a noise stream on connect(), but it crashes when i do not use nextTick
first guess: probably we need one inside noise-peer to fix the issue.
server.js
'use strict'constnoise=require('noise-network')constserver=noise.createServer()conststream=require('stream')consthypercore=require('hypercore')const{ write }=require('length-prefixed-message')conststats=require('./stats')constfeed=hypercore(`./test`)server.on('connection',function(encryptedStream){write(encryptedStream,JSON.stringify({key: feed.key.toString('hex')}))stream.pipeline(encryptedStream,feed.replicate({live: true}),encryptedStream,(err)=>{console.log('replication ended',err)})})constkeyPair=noise.seedKeygen(Buffer.alloc(32,'secret'))server.listen(keyPair,function(){console.log('Server is listening on:',server.publicKey.toString('hex'))})
client.js
constclient=noise.connect('a9a5544b217d38cc0165d3fce9381e38464025d26d1e7e38c4ce4a729e73410b')// when no process.nextTick is used, client crashes// process.nextTick(function () { read(client,(msg)=>{msg=msg.toString()constp=JSON.parse(msg)constfeed=hypercore(`./client-dbs/local-${testGroup}-${id}`,p.key)stream.pipeline(client,feed.replicate({live: true}),client,(err)=>{console.log('replication ended',err)})})// })
The text was updated successfully, but these errors were encountered:
my first noise server! :)
noise-network returns a noise stream on
connect()
, but it crashes when i do not use nextTickfirst guess: probably we need one inside noise-peer to fix the issue.
server.js
client.js
The text was updated successfully, but these errors were encountered: