Socket Controller module
This module provides functionality for allowing clients to send and receive Open Sound Control (OSC) messages through a socket.io connection.
In general, the OSC message flow is as follows:
Outgoing messages:
- A client connects to the server over socket.io
- Client emits the 'sendOSCMessage' event
- SocketServerController module sends message
- After sending the message, SocketServerController emits the 'oscMessageSent' event on the client socket
Incoming messages:
- SocketServerController module listens for
oscMessageReceivedevents emitted by the OSCServerController module - SocketServerController module emits its own
oscMessageReceivedevent on client sockets with the same data
- SocketServerController module listens for
Methods
(static) init(httpServer) → {undefined}
Initializes the module. Once initialized, clients that connect over socket.io receive the messages this module emits, as described above. The server then also listens on each client connection for OSC messages to be sent using the OSCServerController module, also as described above.
Parameters:
| Name | Type | Description |
|---|---|---|
httpServer |
http.Server | A Node.js HTTP server |
Returns:
- Type
- undefined
Events
oscMessageReceived
This event is fired when the module receives an OSC message from the OSCServerController module.
The object sent with this event is a JavaScript object representation of the OSC message.
Type:
- Object
oscMessageSent
This event is fired when the module sends an OSC message using the OSCServerController module.
The object sent with this event is a JavaScript object representation of the OSC message.
Type:
- Object