Class: INRClient

INRClient

Client class wrapping faye client.

Convenience methods and properties to facilitate setting up,
connecting, subscribing and publishing messages to PubSub.


new INRClient(_api, _group, _siteId, _token, _key)

Create a client.

Parameters:
Name Type Description
_api string

the api that we are connecting to

_group string

the group id for the connection

_siteId string

the site id for the connection

_token string

the token being used for the connection

_key string

the private key used for signing messages

Source:

Members


api

Getter for #api.

Source:

client

Getter for #client

Source:

client

Setter for #client.

Source:

extension

Getter for #extension.

Source:

extension

Setter for #extension.

Source:

group

Getter for #group.

Source:

key

Getter for #key.

Source:

onError

Setter for #onError.

Source:

onError

Getter for #onError.

Source:

onSubscribed

Setter for #onSubscribed.

Source:

onSubscribed

Getter for #onSubscribed.

Source:

siteId

Getter for #siteId.

Source:

state

Getter for #state.

Source:

token

Getter for #token.

Source:

Methods


<async> connect(messageBack)

Connect to the faye server.

Setup client and connect to PubSub faye server

Parameters:
Name Type Description
messageBack function

Function to be called when the response from a sent message
comes back.

Source:

disconnect()

Disconnect from server.

Disconnect the client from PubSub server.

Source:

publish(channel, data)

Publish a message to a channel.

Publishes the provided data packet to the provided channel and
waits for the return to return the response to the caller.

Parameters:
Name Type Description
channel string

The channel to publish to.

data Object

Data packet to publish.

Source:

subscribe(channel)

Subscribe to a channel.

This function allows subscribing to a channel and processing
the direct response from PubSub (note this is not the same as
processing the response from another client). Also handles updating
the extension to let it know the state of the subscription and set
the property appropriately. Logs result to console.

Parameters:
Name Type Description
channel string

The channel we are subscribing to.

Source: