OpenVeo server API for plugins

API Docs for: 7.0.0
Show:

SocketController

Summary

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.

// 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);

Constructor

SocketController

Syntax

SocketController

(
  • namespace
)

Summary

Parameters:

  • namespace SocketNamespace

    The socket namespace associated to the controller

Methods

connectAction

Syntax

connectAction

(
  • socket
)

Summary

Handles a client's socket's connection.

Socket has been established with a client.

Parameters:

  • socket Socket

    The socket

disconnectAction

Syntax

disconnectAction

(
  • socket
)

Summary

Handles a client's socket's disconnection.

Socket connection with a client has been lost.

Parameters:

  • socket Socket

    The socket

errorAction

Syntax

errorAction

(
  • error
  • socket
)

Summary

Handles a client's socket's connection errors.

An error occurred on socket's communication.

Parameters:

  • error Error

    The error

  • socket Socket

    The socket

Properties

emitter

Syntax

emitter

AdvancedEmitter final

Summary

An emitter to emits clients' messages.

namespace

Syntax

namespace

SocketNamespace final

Summary

Socket's namespace associated to the controller.