messages

message-bus handler for SockBot2.0

Author: Accalia
License: MIT

messages~processTopicMessage(message)

Process a message that is from a /topic/* channel

Kind: inner method of messages

Param Type Description
message externals.messageBus.message Message to process

messages~updateChannelPositions(messages)

Update channel position for polled messages.

Kind: inner method of messages

Param Type Description
messages Array.<externals.messageBus.message> Messages that were polled

messages~resetChannelPositions()

Reset all channels to position -1.

This is to reset message-bus after poll failure or after software version update

Kind: inner method of messages

messages~statusChannelHandler(message)

Message handler for the /__status message channel

Kind: inner method of messages

Param Type Description
message Object.<string, number> New channel positions

messages~onChannel(channel, handler) ⇒ EventEmitter

Add message-bus non-topic channel listener

Kind: inner method of messages
Returns: EventEmitter - Returns emitter, so calls can be chained.

Param Type Description
channel string Channel to listen to
handler messageHandler Message handler to add

messages~onTopic(topicId, handler) ⇒ EventEmitter

Add message-bus topic channel listener

Kind: inner method of messages
Returns: EventEmitter - Returns emitter, so calls can be chained.

Param Type Description
topicId string Topic to listen to
handler topicMessageHandler Message handler to add

messages~removeChannel(channel, handler) ⇒ EventEmitter

Remove message-bus non-topic channel listener

Kind: inner method of messages
Returns: EventEmitter - Returns emitter, so calls can be chained.

Param Type Description
channel string Channel to remove listener from
handler messageHandler Message handler to remove

messages~removeTopic(topicId, handler) ⇒ EventEmitter

Remove message-bus topic channel listener

Kind: inner method of messages
Returns: EventEmitter - Returns emitter, so calls can be chained.

Param Type Description
topicId string Topic to remove listener from
handler topicMessageHandler Message handler to remove

messages~onMessageAdd(event) ⇒ boolean

Listen for new message-bus channels

Kind: inner method of messages
Returns: boolean - True if event was a message-bus channel, false otherwise

Param Type Description
event string Event that's been registered

messages~onMessageRemove(event) ⇒ boolean

Listen for parting message-bus channels

Kind: inner method of messages
Returns: boolean - True if event was a message-bus channel, false otherwise

Param Type Description
event string Event that has unregistered a handler

messages~completionCallback

Completion Callback

Kind: inner typedef of messages

Param Type Description
err string | Error Filter Error state

messages~filterCallback

Filter Callback

Kind: inner typedef of messages

Param Type Description
err string | Error Filter Error state
reason string Filter Reason

messages~messageHandler

Message-bus Message Handler

Kind: inner typedef of messages

Param Type Description
message externals.messageBus.message Message Recieved

messages~topicMessageHandler

Message-bus Topic Message Handler

Kind: inner typedef of messages

Param Type Description
message externals.messageBus.postMessage Payload of message
topic externals.topics.Topic Topic containing post
post externals.posts.CleanedPost Post that triggered the message