File ./source/OrtcClient.lua

Functions

GettersAndSetters (id, url, clusterUrl, connectionTimeout, isConnected, connectionMetadata, announcementSubChannel, sessionId, sessionFilesPath) Getters and Setters.
OrtcClient:connect (applicationKey, authenticationToken) Connects the client using the supplied application key and authentication token.
OrtcClient:disconnect () Disconnects the client.
OrtcClient:isSubscribed (channel) Indicates whether the client is subscribed to the supplied channel.
OrtcClient:new () Creates a new instance of the ORTC Client class.
OrtcClient:saveAuthentication (url, isCluster, authenticationToken, authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, callback, isCLuster) Saves the channels and its permissions for the supplied application key and authentication token.
OrtcClient:send (channel, message) Sends the supplied message to the supplied channel.
OrtcClient:subscribe (channel, subscribeOnReconnected, onMessageCallback) Subscribes to the supplied channel to receive messages sent to it.
OrtcClient:unsubscribe (channel) Unsubscribes from the supplied channel to stop receiving messages sent to it.
onConnected (ortc) Occurs when the client connects.
onDisconnected (ortc) Occurs when the client disconnects.
onException (ortc, event, error) Occurs when there is an exception.
onReconnected (ortc) Occurs when the client reconnects.
onReconnecting (ortc) Occurs when the client attempts to reconnect.
onSubscribed (ortc, channel) Occurs when the client subscribes to a channel.
onUnsubscribed (ortc, channel) Occurs when the client unsubscribes from a channel.


Functions

GettersAndSetters (id, url, clusterUrl, connectionTimeout, isConnected, connectionMetadata, announcementSubChannel, sessionId, sessionFilesPath)
Getters and Setters.

Parameters

  • id: The client identifier.
  • url: The server URL.
  • clusterUrl: The cluster server URL.
  • connectionTimeout: The connection timeout.
  • isConnected: Indicates whether the client is connected.
  • connectionMetadata: The client connection metadata.
  • announcementSubChannel: The client announcement subchannel.
  • sessionId: The client session identifier.
  • sessionFilesPath: The client session files path.
OrtcClient:connect (applicationKey, authenticationToken)
Connects the client using the supplied application key and authentication token.

Parameters

  • applicationKey: The application key.
  • authenticationToken: The authentication token.

Return value:

void
OrtcClient:disconnect ()
Disconnects the client.

Return value:

void
OrtcClient:isSubscribed (channel)
Indicates whether the client is subscribed to the supplied channel.

Parameters

  • channel: The channel name.

Return value:

Indicates whether the client is subscribed to the supplied channel.
OrtcClient:new ()
Creates a new instance of the ORTC Client class.

Return value:

New instance of the ORTC Client class.
OrtcClient:saveAuthentication (url, isCluster, authenticationToken, authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, callback, isCLuster)
Saves the channels and its permissions for the supplied application key and authentication token.

Parameters

  • url: The ORTC server URL.
  • isCluster:
  • authenticationToken: The authentication token generated by an application server (for instance: a unique session ID).
  • authenticationTokenIsPrivate: Indicates whether the authentication token is private.
  • applicationKey: The application key provided when the ORTC service is purchased.
  • timeToLive: The authentication token time to live (TTL), in other words, the allowed activity time (in seconds).
  • privateKey: The private key provided when the ORTC service is purchased.
  • permissions: The channels and their permissions (w: write/read or r: read, case sensitive).
  • callback: Asynchronous callback raised after the save authentication have been performed.
  • isCLuster: Indicates whether the ORTC server is in a cluster.

Return value:

Indicates whether the authentication was successful.
OrtcClient:send (channel, message)
Sends the supplied message to the supplied channel.

Parameters

  • channel: The channel name.
  • message: The message to send.

Return value:

void
OrtcClient:subscribe (channel, subscribeOnReconnected, onMessageCallback)
Subscribes to the supplied channel to receive messages sent to it.

Parameters

  • channel: The channel name.
  • subscribeOnReconnected: Indicates whether the client should subscribe to the channel when reconnected (if it was previously subscribed when connected).
  • onMessageCallback: The callback called when a message arrives at the channel.

Return value:

void
OrtcClient:unsubscribe (channel)
Unsubscribes from the supplied channel to stop receiving messages sent to it.

Parameters

  • channel: The channel name.

Return value:

void
onConnected (ortc)
Occurs when the client connects.

Parameters

  • ortc: The ORTC Client object.

Return value:

void
onDisconnected (ortc)
Occurs when the client disconnects.

Parameters

  • ortc: The ORTC Client object.

Return value:

void
onException (ortc, event, error)
Occurs when there is an exception.

Parameters

  • ortc: The ORTC Client object.
  • event:
  • error: The occurred exception.

Return value:

void
onReconnected (ortc)
Occurs when the client reconnects.

Parameters

  • ortc: The ORTC Client object.

Return value:

void
onReconnecting (ortc)
Occurs when the client attempts to reconnect.

Parameters

  • ortc: The ORTC Client object.

Return value:

void
onSubscribed (ortc, channel)
Occurs when the client subscribes to a channel.

Parameters

  • ortc: The ORTC Client object.
  • channel: The channel name.

Return value:

void
onUnsubscribed (ortc, channel)
Occurs when the client unsubscribes from a channel.

Parameters

  • ortc: The ORTC Client object.
  • channel: The channel name.

Return value:

void

Valid XHTML 1.0!