Streams.Message Class
Class representing 'Message' rows in the 'Streams' database
stored primarily on publisherId's fm server
Constructor
Streams.Message
-
fields
Parameters:
-
fields
ObjectThe fields values to initialize table row as an associative array of
{column: value}
pairs
Item Index
Methods
define
-
type
-
ctor
-
methods
Call this function to set a constructor for a message type
deliver
-
stream
-
toUserId
-
deliver
-
avatar
-
callback
Delivers the message posted to stream according to particular delivery method (see: Streams_SubscriptionRule.deliver). Message template is taken from views/{message.type} folder - 'email.handlebars' or 'mobile.handlebars' or 'device.handlebars' depending on delivery
Parameters:
-
stream
Streams.Stream -
toUserId
Functionthe id of the user to whom to deliver
-
deliver
String | Objectcan be any key under "Streams"/"rules"/"deliver" config, such as "default" or "invited". The value in the config should be an array of entries, each of which can be a string or an array itself. Entries can contain one or more of "email", "mobile" and "devices". They are tried, in order, and delivery stops as soon as at least one destination is found to deliver to. Or, it can be an object with "to" property as this key, or "emailAddress", "mobileNumber" or "deviceId" specified directly.
-
avatar
Streams.Avatarthe avatar for getting the displayName
-
callback
FunctionCallback reports errors and response from delivery systems
getAll
()
Get all the instructions from a message.
getInstruction
-
instructionName
Get the value of an instruction in the message
Parameters:
-
instructionName
String
post
-
fields
-
callback=null
Posts a message to the stream. Currently doesn't perform any access checks, so it is only meant to be called internally. It is not as robust as the PHP version, which is meant for more general use.
setUp
()
The setUp() method is called the first time an object of this class is constructed.