Skip to content

Latest commit

 

History

History
114 lines (84 loc) · 5.28 KB

CLIENT.md

File metadata and controls

114 lines (84 loc) · 5.28 KB

DirectStreamAccess : DirectStreamAccess

Implementation for the CLIENT side. Available as Meteor.directStream singleton.

Kind: global class
Extends: DirectStreamAccessCommon
Category: CLIENT

meteor.directStream.send(message, connection)

Sends a message to the server. This method does not throw any error if there is no connection to server. If you care about this check the status with Meteor.status() before sending anything. You can pass an additional custom DDP connection in order to use that one instead the default one.

Kind: instance method of DirectStreamAccess

Param Type Description
message string Message to send to the server.
connection Object DDP connection instance or connection id.

meteor.directStream.registerConnection([connection]) ⇒ Symbol

Register a custom connection from DDP.connect.

Kind: instance method of DirectStreamAccess
Returns: Symbol - Id of the additional DDP connection.

Param Type Description
[connection] Object Reference to DDP connection object.

meteor.directStream.getMainConnectionId() ⇒ null | Symbol

Returns the id of the main DDP connection.

Kind: instance method of DirectStreamAccess

meteor.directStream.onMessage(messageHandler)

Registers a message handler, which will be called to process every incoming message on the socket.

Kind: instance method of DirectStreamAccess

Param Type Description
messageHandler messageHandler Function to process the incoming messages.

meteor.directStream.preventCallingMeteorHandler()

Prevents calling the original meteor message handler. Makes the message invisible for Meteor. Since any message handler is bound to this class, inside the message handler it is just called with this.preventCallingMeteorHandler().

Kind: instance method of DirectStreamAccess

meteor.directStream.stopProcessingHandlers()

Stops processing any other message handlers. Since any message handler is bound to this class, inside the message handler it is just called with this.stopProcessingHandlers().

Kind: instance method of DirectStreamAccess

meteor.directStream._processMessage(message, [sessionId], [userId], [connectionId], [connection])

Passes the received message to registered handlers.

Kind: instance method of DirectStreamAccess
Access: protected

Param Type Description
message string Raw 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.

Meteor.directStream~messageHandler : function

Callback passed to the registerMessageHandler that should process the incoming messages.

Kind: inner typedef of DirectStreamAccess

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.