SocketInterface

SocketInterface

A collection of helper methods designed to orchestrate the client side socket workflow in a standardized way.

Constructor

new SocketInterface()

Source:

Methods

(async, static) handle()

Source:

Generalized handler for single-target responses

(async, static) handleMany()

Source:

Generalized handler for multi-target responses

(async, static) trigger(eventName, eventData, options, preHook, postHook, context, success) → {Promise}

Source:

A generalized socket trigger interface which standardizes the way that information is provided to the server

Parameters:
Name Type Description
eventName String

The socket event name to emit

eventData Object

Data provided to the server as part of the event

options Object

Additional options which contextualize the socket request

preHook String

If an optional preHook is provided, ensure it does not return false before proceeding with the socket emission.

postHook String

The name of an optional post-hook event to call with the resolved context and the provided event arguments.

context *

The Entity or Object context for the request. Passed as the first argument to the preHook.

success function

A function to call upon successful receipt of response.

Returns:

A Promise which resolves to the return value of the provided handler function

Type
Promise

(async, static) triggerMany(eventName, eventData, options, preHook, postHook, context, success) → {Promise}

Source:

A generalized socket trigger interface which standardizes the way that information is provided to the server Similar to the basic trigger method, except this method is responsible for triggering multi-object operations

Parameters:
Name Type Description
eventName String

The socket event name to emit

eventData Array

Data provided to the server as part of the event

options Object

Additional options which contextualize the socket request

preHook String

If an optional preHook is provided, ensure it does not return false before proceeding with the socket emission.

postHook String

The name of an optional post-hook event to call with the resolved context and the provided event arguments.

context *

The Entity or Object context for the request. Passed as the first argument to the preHook.

success function

A function to call upon successful receipt of response.

Returns:

A Promise which resolves to the return value of the provided handler function

Type
Promise