Messenger namespace

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Service Client API Reference for version Current of Developer.

Learn about the Messenger namespace methods in the Service Client API.


The Messenger namespace includes the following methods:


Signature <static> broadcastMessage(channel, message, succeeded, failed)
Description Send a message to other web applications that use the Service Client API and have subscribed to the specified channel.
Name Type Description
channel string The channel to send the message on.
message object The message (any JSON object) to broadcast on the channel.
succeeded function A function called when the operation succeeds.
failed function A function called when the operation fails.


// Add a new message broadcaster:
genesys.wwe.service.messenger.broadcastMessage("my-channel", { foo: "A foo text.", bar: 1234 }, succeeded, failed)
// The operation "broadcastMessage" from the service "messenger" takes a channel name and any JSON-compliant object.
// In order to receive this message, you must "subscribe" to "my-channel":
genesys.wwe.service.subscribe([ "messenger:my-channel" ], function(message) { console.log("message: " +; }, this);
// It is possible to subscribe to several channels:
genesys.wwe.service.subscribe([ "messenger:my-channel", "messenger:my-channel2" ], function(message) {
  console.log("message: " + + ", channel: " + message.event);
}, this);
When a message is broadcast to your channel, you receive an event called messenger:<channel> with the message in the data attribute. For example, here's the event for the broadcast in the sample above:
  "event": "messenger:my-channel",
  "data": {
    "foo": "A foo text.",
    "bar": 1234
  "userAgent": "WWE Server",
  "protocolVersion": 2
Comments or questions about this documentation? Contact us for support!