Message Manager

This package is used for Application Group Messaging

The Message Manager provides a way for the web application to receive external messages. The web application needs to register the device to a specific group(s). Once registered, when a group message is sent to a specific group(s), any device that is registered for that group(s) will receive the message with its payload.

Application Group Message API

See group messaging endpoint: Group Messaging API

Message Manager SDK

Modules

messageManagerMessageManager

Classes

MessageManager

MessageManager is a singleton class that manages the external messages received by the application. It fires custom events as "message" with the payload as the content

Typedefs

MessageDetails : object

object which contains the content of the message

messageManager ⇒ MessageManager

Returns: MessageManager - pointer to the MessageManager singleton
Example

import { MessageManager } from "senza-sdk";

MessageManager

MessageManager is a singleton class that manages the external messages received by the application. It fires custom events as "message" with the payload as the content.

Kind: global class
Emits: message

messageManager.registerGroups(groups) ⇒ Promise

Register to specific group(s). This function replaces the previously registered groups.

Kind: instance method of MessageManager
Returns: Promise - Promise which is resolved when the registerGroups command has been successfully processed.
Failure to process the registerGroups command will result in the promise being rejected.
messageManager.registerGroups(["A","B"]);

ParamTypeDescription
groupsArraygroup events to receive messages

"message"

Fired when an external event arrives. This is a generic handler for all messages received for any registered group.

Kind: event emitted by MessageManager
Properties

NameTypeDescription
detailMessageDetailsobject containing data related to the event

Example

messageManager.addEventListener("message", (e) => {
    console.log("message arrived with data", e.detail);
});

MessageDetails : object

Object which contains the content of the message.

Kind: global typedef
Properties

NameTypeDescription
eventNamestringThe name of the event message, a property of MessageDetails
payloadobjectThe payload for this event, a property of MessageDetails
fcidstringThe flow context for this message, a property of MessageDetails

What’s Next