Socket Hang up Error

+1 vote

I was trying to store the new user on the multichain blockchain using streams before storing it to the database. I am getting socket error and when I am trying to store the new user using streams. 

I have setup the multichainOptions correctly and running the blockchain locally

{ Error: socket hang up
[0]     at createHangUpError (_http_client.js:313:15)
[0]     at Socket.socketOnEnd (_http_client.js:416:23)
[0]     at Socket.emit (events.js:187:15)
[0]     at endReadableNT (_stream_readable.js:1081:12)
[0]     at process._tickCallback (internal/process/next_tick.js:63:19) code: 'ECONNRESET' }
[0] User : undefined

******************************************* Here is the code 

const newUser = new User({

name: req.body.name,

email: req.body.email,

avatar,

password: req.body.password

});

const dataStr = JSON.stringify({

name: newUser.name,

email: newUser.email,

avatar: newUser.avatar

});

//multichain code goes here

multichain.publish(

{

stream: "users",

key: "prateek",

data: StrToHex(dataStr)

},

(err, info) => {

console.log(`User : ` + info);  # getting undefined here along with the error 

}

Please if anyone can help I am newbie to multichain and this is my first project using it. I am using multichain-node

asked Apr 20 by Prateek

1 Answer

0 votes

Before using this library, we recommend trying the same operation with the multichain-cli command line tool. That will help you understand whether the issue is with MultiChain not being configured correctly, or else the library you are using.

answered Apr 21 by MultiChain
Thanks a lot ! I solved it was just that I had to add autosubscribe key as streams to the multichain.conf file and it worked well for me. Thanks again !!
...