S
S
SKEPTIC2020-07-21 23:39:09
Node.js
SKEPTIC, 2020-07-21 23:39:09

Asynchronous node.js websockets?

How to make a server on node.js asynchronous web sockets?
Or are they asynchronous out of the box? I myself came from Python and there I need to work with coroutines and async await.

Here I have no idea how to do it. Roughly speaking, you need a web socket server that can serve many connections at the same time.

There is this code:

wss.on('connection', function connection(ws) {
  ws.on('message', function incoming(message) {
    ws.send(message);
  });

});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2020-07-21
@inoise

all JS out of the box is asynchronous

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question