ClientMessageBridge. API description
Glossary Item Box
Properties
WebSocketMessageConfigs: Array Collection of configuration objects. |
LocalStoreName: String Name of the repository, where the message history is stored. |
LocalStore: Terrasoft.LocalStore An instance of class that implements access to local repository. |
Methods
init() Initializes default values. |
getSandboxMessageListenerExists(sandboxMessageName) Checks for available listeners of message with passed name. Parameters: sandboxMessageName: String – message name that will be used when sending the message within the system. Returned value: Boolean – the result of checking for available message listeners |
publishMessageResult(sandboxMessageName, webSocketMessage) Publishes the message within the system. Parameters: sandboxMessageName: String – message name that will be used when sending the message within the system. webSocketMessage: Object – message received by WebSocket. Returned value: * – result obtained from the message handler. |
beforePublishMessage(sandboxMessageName, webSocketBody, publishConfig) Handler that is called before publishing the message within the system. Parameters: sandboxMessageName: String – message name that will be used when sending the message within the system. webSocketBody: Object – message received by WebSocket. publishConfig: Object – configuration object of message broadcast. |
afterPublishMessage(sandboxMessageName, webSocketBody, result, publishConfig) Handler that is called after publishing the message within the system. Parameters: sandboxMessageName: String – message name that will be used when sending the message within the system. webSocketBody: Object – message received by WebSocket. result: * – result of publishing the message within the system. publishConfig: Object – configuration object of message broadcast. |
addMessageConfig(config) Adds a new configuration object to a collection of configuration objects. Parameters: config: Object – configuration object. Configuration object parameter: { "sender": "webSocket sender key 1", "messageName": "sandbox message name 1", "isSaveHistory": true } Where:
|
saveMessageToHistory(sandboxMessageName, webSocketBody) Saves message in the repository if there is no subscriber and the save checkbox is selected in the configuration object. Parameters: sandboxMessageName: String – message name that will be used when sending the message within the system. webSocketBody: Object – message received by WebSocket. |
getMessagesFromHistory(sandboxMessageName) Gets an array of saved messages from the repository. Parameters: sandboxMessageName: String – message name that will be used when sending the message within the system. |
deleteSavedMessages(sandboxMessageName) Deletes saved messages from the repository. Parameters: sandboxMessageName: String – message name that will be used when sending the message within the system. |