Skip to content

Latest commit

 

History

History
106 lines (76 loc) · 4.76 KB

DYNAMIC_MESSAGES_PROTOCOL.md

File metadata and controls

106 lines (76 loc) · 4.76 KB

DynamicMessagesProtocol : DynamicMessagesProtocol

Implementation of common logic for dynamic messages type protocols.

Kind: global abstract class
Extends: CustomProtocol
Category: PROTOCOLS

new DynamicMessagesProtocol(name)

Param Type Description
name string Class name of the protocol.

dynamicMessagesProtocol.processMessages(message, sessionId, [userId], [connectionId], [connection])

Fires callbacks registered for a concrete type of message. The type of message is checked in the message itself by checking the field with name specified with this.setTypeFieldName.

Kind: instance method of DynamicMessagesProtocol

Param Type Description
message Object Decoded message object.
sessionId string Session id of sender.
[userId] string User id if available.
[connectionId] Symbol Id of the additional DDP connection.
[connection] Object Reference to DDP connection object.

dynamicMessagesProtocol.on(messageType, callback)

Registers a callback for a specified message type.

Kind: instance method of DynamicMessagesProtocol

Param Type Description
messageType string Message type.
callback messageHandler Callback to fire.

dynamicMessagesProtocol.removeCallback(messageType, callback)

Removes a callback for a specified message type.

Kind: instance method of DynamicMessagesProtocol

Param Type Description
messageType string Message type.
callback messageHandler Callback to remove.

dynamicMessagesProtocol.removeAllCallbacks(messageType)

Removes all callbacks for a specified message type.

Kind: instance method of DynamicMessagesProtocol

Param Type Description
messageType string Message type.

dynamicMessagesProtocol.send(messageType, payload, target, deferred)

Sends the specified message type with payload.

Kind: instance method of DynamicMessagesProtocol

Param Type Default Description
messageType string Message type.
payload Object Object with the data.
target Array | string | Object Server: session id or an array of it, client: ddp connection instance.
deferred boolean false Specifies whether to defer the sending in the loop.

DynamicMessagesProtocol~messageHandler : function

Kind: inner typedef of DynamicMessagesProtocol

Param Type Description
message string Message received on the socket.
[sessionId] string Meteor's internal session id.
[userId] string User id if available.
[connectionId] Symbol Id of the additional DDP connection.
[connection] Object Reference to DDP connection object.