Class Index | File Index

Classes


Class MessagingJSON.Client


Defined in: jsonmsg.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
MessagingJSON.Client(host, port, path, clientId)
The JavaScript application communicates with IBM MessageSight via the json_msg plug-in using a MessagingJSON.Client object.
Field Summary
Field Attributes Field Name and Description
 
- read only used when connecting to IBM MessageSight.
 
- read only the IBM MessageSight DNS hostname or dotted decimal IP address.
 
- read only the IBM MessageSight path.
 
- read only the IBM MessageSight port.
Method Summary
Method Attributes Method Name and Description
 
closeTopicSubscription(subscriptionName, options)
Close a subscription identified by a subscrption name.
 
connect(connectOptions)
Connect this MessagingJSON client to IBM MessageSight via the json_msg plug-in.
 
createTopicSubscription(filter, subscribeOptions)
Subscribe for messages, request receipt of a copy of messages sent to the destinations described by the filter.
 
Normal disconnect of this MessagingJSON client from IBM MessageSight.
 
Get the contents of the trace log.
 
send(message, options)
Send a message to the consumers of the destination in the Message.
 
Start tracing.
 
Stop tracing.
Class Detail
MessagingJSON.Client(host, port, path, clientId)
The JavaScript application communicates with IBM MessageSight via the json_msg plug-in using a MessagingJSON.Client object. The send, subscribe and unsubscribe methods are implemented as asynchronous JavaScript methods (even though the underlying protocol exchange might be synchronous in nature). This means they signal their completion by calling back to the application via Success or Failure callback functions provided by the application on the method in question. These callbacks are called at most once per method invocation and do not persist beyond the lifetime of the script that made the invocation.

In contrast there are some callback functions, most notably onMessageArrived, that are defined on the MessagingJSON.Client object. These callbacks might be called multiple times, and are not directly related to specific method invocations made by the client.

Parameters:
{string} host
- the address of the IBM MessageSight host, as a fully qualified WebSocket URI, as a DNS name or dotted decimal IP address.
{number} port
- the port number to connect to - only required if host is not a URI
{string} path
- the path on the host to connect to - only used if host is not a URI. Default: '/json-msg'.
{string} clientId
- the MessagingJSON client identifier, between 0 and 65535 characters in length.
Field Detail
{string} clientId
- read only used when connecting to IBM MessageSight.

{string} host
- read only the IBM MessageSight DNS hostname or dotted decimal IP address.

{string} path
- read only the IBM MessageSight path.

{number} port
- read only the IBM MessageSight port.
Method Detail
closeTopicSubscription(subscriptionName, options)
Close a subscription identified by a subscrption name.
Parameters:
{string} subscriptionName
The name of the subscription to close.
{object} options
- used to control the subscription
{function} options.onSuccess
- called when the subscribe acknowledgement has been received from IBM MessageSight.
{function} options.onFailure
- called when the subscribe request has failed or timed out. A single response object parameter is passed to the onFailure callback containing the following fields:
  1. errorCode - a number indicating the nature of the error.
  2. errorMessage - text describing the error.
{number} options.timeout
- which, if present, determines the number of seconds after which the onFailure calback is called. The presence of a timeout does not prevent the onSuccess callback from being called when the subscribe completes.
Throws:
{InvalidState}
if the client is not in connected state.

connect(connectOptions)
Connect this MessagingJSON client to IBM MessageSight via the json_msg plug-in.
Parameters:
{Object} connectOptions
- attributes used with the connection.
{number} connectOptions.timeout
- If the connect has not succeeded within this number of seconds, it is deemed to have failed. The default is 30 seconds.
{string} connectOptions.userName
- Authentication username for this connection.
{string} connectOptions.password
- Authentication password for this connection.
{Number} connectOptions.keepAliveInterval
- the interval in seconds to check if this client is still connected to IBM MessageSight - and that MessageSight can respond.
{Number} connectOptions.keepAliveTimeout
- the json_msg plug-in disconnects this client if there is no activity for this number of seconds. If not specified the server assumes 60 seconds.
{boolean} connectOptions.useSSL
- if present and true, use an SSL Websocket connection.
{function} connectOptions.onSuccess
- called when the connect acknowledgement has been received from IBM MessageSight.
{function} connectOptions.onFailure Optional
called when the connect request has failed or timed out. A single response object parameter is passed to the onFailure callback containing the following fields:
  1. errorCode a number indicating the nature of the error.
  2. errorMessage text describing the error.
Throws:
{InvalidState}
if the client is not in disconnected state. The client must have received connectionLost or disconnected before calling connect for a second or subsequent time.

createTopicSubscription(filter, subscribeOptions)
Subscribe for messages, request receipt of a copy of messages sent to the destinations described by the filter.
Parameters:
{string} filter
describing the destinations to receive messages from.
{object} subscribeOptions
- used to control the subscription
{number} subscribeOptions.qos
- the maiximum reliability of any publications sent as a result of making this subscription. Valid settings are:
0 - at most once.
1 - at least once.
2 - exactly once.
{function} subscribeOptions.onSuccess
- called when the subscribe acknowledgement has been received from IBM MessageSight.
{function} subscribeOptions.onFailure
- called when the subscribe request has failed or timed out. A single response object parameter is passed to the onFailure callback containing the following fields:
  1. errorCode - a number indicating the nature of the error.
  2. errorMessage - text describing the error.
{number} subscribeOptions.timeout
- which, if present, determines the number of seconds after which the onFailure calback is called. The presence of a timeout does not prevent the onSuccess callback from being called when the subscribe completes.
Throws:
{InvalidState}
if the client is not in connected state.

disconnect()
Normal disconnect of this MessagingJSON client from IBM MessageSight.
Throws:
{InvalidState}
if the client is already disconnected.

{Object[]} getTraceLog()
Get the contents of the trace log.
Returns:
{Object[]} tracebuffer containing the time ordered trace records.

send(message, options)
Send a message to the consumers of the destination in the Message.
Parameters:
{MessagingJSON.Message} message
to send.
{object} options
- used to control the subscription
{function} options.onSuccess
- called when the subscribe acknowledgement has been received from IBM MessageSight.
{function} options.onFailure
- called when the subscribe request has failed or timed out. A single response object parameter is passed to the onFailure callback containing the following fields:
  1. errorCode - a number indicating the nature of the error.
  2. errorMessage - text describing the error.
{number} options.timeout
- which, if present, determines the number of seconds after which the onFailure calback is called. The presence of a timeout does not prevent the onSuccess callback from being called when the subscribe completes.
Throws:
{InvalidState}
if the client is not connected.

startTrace()
Start tracing.

stopTrace()
Stop tracing.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed May 25 2016 22:00:50 GMT+0100 (BST)