On this page
The Server instance
The Server instance (often called io
in the code examples) has a few attributes that may be of use in your application.
It also inherits all the methods of the main namespace, like namespace.use()
(see here) or namespace.allSockets()
.
Server#engine
A reference to the underlying Engine.IO server.
It can be used to fetch the number of currently connected clients:
|
Or to generate a custom session ID (the sid
query parameter):
|
Events
The Server instance emits one single event (well, technically two, but connect
is an alias for connection
):
connection
This event is fired upon a new connection. The first argument is a Socket instance.
|
Complete API
The complete API exposed by the Server instance can be found here.
© 2014–2021 Automattic
Licensed under the MIT License.
https://socket.io/docs/v3/server-instance