Constructor
new SocketController(namespace)
Defines base controller for all controllers which need to handle socket messages.
A SocketController is associated to a namespace to be able to emit a message to the whole socket namespace.
A SocketController is also associated to an emitter to emit socket's clients' messages to pilots.
Parameters:
Name | Type | Description |
---|---|---|
namespace |
module:socket/SocketNamespace~SocketNamespace | The socket namespace associated to the controller |
- Source:
Example
// Implement a SocketController : "CustomSocketController"
var util = require('util');
var openVeoApi = require('@openveo/api');
function CustomSocketController(namespace) {
CustomSocketController.super_.call(this, namespace);
}
util.inherits(CustomSocketController, openVeoApi.controllers.SocketController);
Extends
Members
(readonly) emitter :module:emitters/AdvancedEmitter~AdvancedEmitter
An emitter to emits clients' messages.
Type:
- Source:
(readonly) namespace :module:socket/SocketNamespace~SocketNamespace
Socket's namespace associated to the controller.
Type:
- Source:
Methods
connectAction(socket)
Handles a client's socket's connection.
Socket has been established with a client.
Parameters:
Name | Type | Description |
---|---|---|
socket |
Object | The socket (see https://socket.io/docs/v4/server-socket-instance) |
- Source:
disconnectAction(socket)
Handles a client's socket's disconnection.
Socket connection with a client has been lost.
Parameters:
Name | Type | Description |
---|---|---|
socket |
Object | The socket (see https://socket.io/docs/v4/server-socket-instance) |
- Source:
errorAction(socket)
Handles a client's socket's connection errors.
An error occurred on socket's communication.
Parameters:
Name | Type | Description |
---|---|---|
socket |
Object | The socket (see https://socket.io/docs/v4/server-socket-instance) |
- Source: