Constructor
new Server(port)
Create a WorkerServer instance
Parameters:
Name | Type | Default | Description |
---|---|---|---|
port |
number | 3000 | The port on which the socket.io server should listen. If the port is busy, then will try port + 1, then port + 2, etc... |
Members
Methods
browserConnection(browserId) → {Promise.<Socket>}
Returns a promise resolved when the browser with browserId connects to the server. The promise returns a socket toward the browser once resolved.
Parameters:
Name | Type | Description |
---|---|---|
browserId |
number | The ID of the browser to await |
- Promise for the socket toward the browser
Promise.<Socket>
getPort() → {number}
- The port where the socket.io server is running
number
async run(listeneropt) → {Promise}
Start the socket.io server
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
listener |
function |
<optional> |
Function executed for listening. Mostly usefull for printing messages when server start |
Promise