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
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
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
- "message"
- .registerGroups(groups) ⇒
messageManager.registerGroups(groups) ⇒ Promise
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"]);
Param | Type | Description |
---|---|---|
groups | Array | group 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
Name | Type | Description |
---|---|---|
detail | MessageDetails | object containing data related to the event |
Example
messageManager.addEventListener("message", (e) => {
console.log("message arrived with data", e.detail);
});
MessageDetails : object
object
Object which contains the content of the message.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
eventName | string | The name of the event message, a property of MessageDetails |
payload | object | The payload for this event, a property of MessageDetails |
fcid | string | The flow context for this message, a property of MessageDetails |
Updated 5 months ago