Module: SocketServerController

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:

    1. A client connects to the server over socket.io
    2. Client emits the 'sendOSCMessage' event
    3. SocketServerController module sends message
    4. After sending the message, SocketServerController emits the 'oscMessageSent' event on the client socket
  • Incoming messages:

    1. SocketServerController module listens for oscMessageReceived events emitted by the OSCServerController module
    2. SocketServerController module emits its own oscMessageReceived event on client sockets with the same data
Source:

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

Source:
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
Source:

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
Source: