uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.85k stars 570 forks source link

How to supply host to listen() #456

Closed be-thomas closed 3 years ago

be-thomas commented 3 years ago

I have code like this -

require('uWebSockets.js').App().ws('/*', ... ).get('/*', ...).listen(9001, (listenSocket) => {

  if (listenSocket) {
    console.log('Listening to port 9001');
  }

How do I make this listen at 127.0.0.1:9001 or 192.168.0.1:9001 ?

ghost commented 3 years ago

You can read the docs https://unetworking.github.io/uWebSockets.js/generated/interfaces/templatedapp.html#listen