new io(serveropt, configopt)
The socket module that allows for peer-to-peer connection support.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
server | Object | <optional> | Reference to the HTTP server that will be used to listen for new connections |
config | Object | <optional> | Settings for the socket connection; used for setting CORS origin for connection |
Fires:
Events
connect
The client-side socket object that will connect to the server
Type:
- Object
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
path | string | <optional> | Endpoint to connect to the associated server where io.connect is |
- Source
Fires:
- socket#event:emit
Listens to Events:
Listeners of This Event:
on
Handles setting up initial server-side functions for new socket.io connections that it picks up.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
label | string | <optional> | Label of the signal that io picks up |
callback | function | <optional> | Function that acts on a connecting socket that is called when hit |
Listens to Events: