I'm using the ws package to create websockets in nodeJS.
However, what i'm trying to do is once data is sent to the server, the socket must terminate. I'm not sure how to go about doing this.
My code now looks like this, but the problem here is terminate could before any data is sent.
ws.on('open', function open() {
console.log('subscribing');
ws.send(creds);
ws.terminate();
resolve(1);
});
What is the right way to go about doing this?
via Haider Ali
No comments:
Post a Comment