Realtime Messaging
Public Member Functions | Protected Member Functions | Events | List of all members
RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient Class Reference

Real Time SJ type client. More...

Inheritance diagram for RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient:
RealtimeMessaging.DotNetCore.Extensibility.OrtcClient

Public Member Functions

 RealTimeSJClient ()
 Initializes a new instance of the RTRealTimeSClient class. More...
 
override async Task Connect (string appKey, string authToken)
 Connects to the gateway with the application key and authentication token. The gateway must be set before using this method. More...
 
override void publish (string channel, string message, int ttl, OnPublishResultDelegate callback)
 Publish a message to a channel. More...
 
override async Task Send (string channel, string message)
 Sends a message to a channel. More...
 
override async Task SendProxyAsync (string applicationKey, string privateKey, string channel, string message)
 
override async Task Subscribe (string channel, bool subscribeOnReconnected, OnMessageDelegate onMessage)
 Subscribes to a channel. More...
 
override async Task SubscribeWithFilter (String channel, Boolean subscribeOnReconnect, String filter, OnMessageWithFilterDelegate onMessage)
 Subscribe the specified channel in order to receive messages in that channel More...
 
override async Task SubscribeWithOptions (Dictionary< string, object > options, OnMessageWithOptionsDelegate onMessage)
 Subscribes to a channel with given options. More...
 
override async Task subscribeWithBuffer (String channel, String subscriberId, OnMessageWithBufferDelegate onMessage)
 Subscribes to a channel with buffer. More...
 
override async Task Unsubscribe (string channel)
 Unsubscribes from a channel. More...
 
override async void Disconnect ()
 Disconnects from the gateway. More...
 
override bool IsSubscribed (string channel)
 Indicates whether is subscribed to a channel. More...
 
override void Presence (String channel, OnPresenceDelegate callback)
 Gets the subscriptions in the specified channel and if active the first 100 unique metadata. More...
 
override void EnablePresence (String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback)
 Enables presence for the specified channel with first 100 unique metadata if metadata is set to true. More...
 
override void DisablePresence (String privateKey, String channel, OnDisablePresenceDelegate callback)
 Disables presence for the specified channel. More...
 
- Public Member Functions inherited from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient
string ReadLocalStorage (string applicationKey, int sessionExpirationTime)
 Reads the local storage. More...
 
void CreateLocalStorage (string applicationKey)
 Creates the local storage. More...
 

Protected Member Functions

async void sendAckAsync (String channel, String messageId, String seqId, String asAllParts)
 

Events

override OnConnectedDelegate OnConnected
 Occurs when a connection attempt was successful. More...
 
override OnDisconnectedDelegate OnDisconnected
 Occurs when the client connection terminated. More...
 
override OnSubscribedDelegate OnSubscribed
 Occurs when the client subscribed to a channel. More...
 
override OnUnsubscribedDelegate OnUnsubscribed
 Occurs when the client unsubscribed from a channel. More...
 
override OnExceptionDelegate OnException
 Occurs when there is an error. More...
 
override OnReconnectingDelegate OnReconnecting
 Occurs when a client attempts to reconnect. More...
 
override OnReconnectedDelegate OnReconnected
 Occurs when a client reconnected. More...
 
- Events inherited from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient
abstract OnConnectedDelegate OnConnected
 Occurs when a connection attempt was successful. More...
 
abstract OnDisconnectedDelegate OnDisconnected
 Occurs when the client connection terminated. More...
 
abstract OnSubscribedDelegate OnSubscribed
 Occurs when the client subscribed to a channel. More...
 
abstract OnUnsubscribedDelegate OnUnsubscribed
 Occurs when the client unsubscribed from a channel. More...
 
abstract OnExceptionDelegate OnException
 Occurs when there is an error. More...
 
abstract OnReconnectingDelegate OnReconnecting
 Occurs when a client attempts to reconnect. More...
 
abstract OnReconnectedDelegate OnReconnected
 Occurs when a client reconnected. More...
 

Additional Inherited Members

- Public Attributes inherited from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient
const int MAX_MESSAGE_SIZE = 700
 Message maximum size in bytes More...
 
const int MAX_CHANNEL_SIZE = 100
 Channel maximum size in bytes More...
 
const int MAX_CONNECTION_METADATA_SIZE = 256
 Connection Metadata maximum size in bytes More...
 
const string SESSION_STORAGE_NAME = "ortcsession-"
 Session storage name More...
 
- Properties inherited from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient
string Id [get, set]
 Gets or sets the client object identifier. More...
 
string Url [get, set]
 Gets or sets the gateway URL. More...
 
string ClusterUrl [get, set]
 Gets or sets the cluster gateway URL. More...
 
bool IsCluster [get, set]
 Gets or sets a value indicating whether this instance is cluster. More...
 
int ConnectionTimeout [get, set]
 Gets or sets the connection timeout. Default value is 5000 miliseconds. More...
 
bool IsConnected [get, set]
 Gets a value indicating whether this client object is connected. More...
 
string ConnectionMetadata [get, set]
 Gets or sets the client connection metadata. More...
 
string AnnouncementSubChannel [get, set]
 Gets or sets the client announcement subchannel. More...
 
string SessionId [get, set]
 Gets or sets the session id. More...
 
bool HeartbeatActive [get, set]
 Gets or sets a value indicating whether this client has a heartbeat activated. More...
 
int HeartbeatFails [get, set]
 Gets or sets a value indicating how many times can the client fail the heartbeat. More...
 
int HeartbeatTime [get, set]
 Gets or sets the heartbeat interval. More...
 

Detailed Description

Real Time SJ type client.

Constructor & Destructor Documentation

◆ RealTimeSJClient()

RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.RealTimeSJClient ( )

Initializes a new instance of the RTRealTimeSClient class.

Member Function Documentation

◆ Connect()

override async Task RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.Connect ( string  appKey,
string  authToken 
)
virtual

Connects to the gateway with the application key and authentication token. The gateway must be set before using this method.

Parameters
appKeyYour application key to use ORTC.
authTokenAuthentication token that identifies your permissions.
ortcClient.Connect("myApplicationKey", "myAuthenticationToken");

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ DisablePresence()

override void RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.DisablePresence ( String  privateKey,
String  channel,
OnDisablePresenceDelegate  callback 
)
virtual

Disables presence for the specified channel.

Parameters
privateKeyThe private key provided when the ORTC service is purchased.
channelChannel to disable presence.
callbackCallback with error OrtcPresenceException and result.

Implements RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ Disconnect()

override async void RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.Disconnect ( )
virtual

Disconnects from the gateway.

ortcClient.Disconnect();

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ EnablePresence()

override void RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.EnablePresence ( String  privateKey,
String  channel,
bool  metadata,
OnEnablePresenceDelegate  callback 
)
virtual

Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.

Parameters
privateKeyThe private key provided when the ORTC service is purchased.
channelChannel to activate presence.
metadataDefines if to collect first 100 unique metadata.
callbackCallback with error OrtcPresenceException and result.

///

client.EnablePresence("myPrivateKey", "presence-channel", false, (error, result) =>
{
if (error != null)
{
Console.WriteLine(error.Message);
}
else
{
Console.WriteLine(result);
}
});

Implements RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ IsSubscribed()

override bool RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.IsSubscribed ( string  channel)
virtual

Indicates whether is subscribed to a channel.

Parameters
channelThe channel name.
Returns
true if subscribed to the channel; otherwise, false.

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ Presence()

override void RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.Presence ( String  channel,
OnPresenceDelegate  callback 
)
virtual

Gets the subscriptions in the specified channel and if active the first 100 unique metadata.

Parameters
channelChannel with presence data active.
callbackOnPresenceDelegateCallback with error OrtcPresenceException and result Presence.
client.Presence("presence-channel", (error, result) =>
{
if (error != null)
{
Console.WriteLine(error.Message);
}
else
{
if (result != null)
{
Console.WriteLine(result.Subscriptions);
if (result.Metadata != null)
{
foreach (var metadata in result.Metadata)
{
Console.WriteLine(metadata.Key + " - " + metadata.Value);
}
}
}
else
{
Console.WriteLine("There is no presence data");
}
}
});

Implements RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ publish()

override void RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.publish ( string  channel,
string  message,
int  ttl,
OnPublishResultDelegate  callback 
)
virtual

Publish a message to a channel.

Parameters
channelChannel name.
messageMessage to be sent.
ttlThe message expiration time in seconds (0 for maximum allowed ttl).
callbackReturns error if message publish was not successful or published message unique id (seqId) if sucessfully published
ortcClient.publish("channelName", "messageToSend");

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ Send()

override async Task RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.Send ( string  channel,
string  message 
)
virtual

Sends a message to a channel.

Parameters
channelChannel name.
messageMessage to be sent.
ortcClient.Send("channelName", "messageToSend");

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ Subscribe()

override async Task RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.Subscribe ( string  channel,
bool  subscribeOnReconnected,
OnMessageDelegate  onMessage 
)
virtual

Subscribes to a channel.

Parameters
channelChannel name.
subscribeOnReconnectedSubscribe to the specified channel on reconnect.
onMessageOnMessageDelegate callback.
ortcClient.Subscribe("channelName", true, OnMessageCallback);
private void OnMessageCallback(object sender, string channel, string message)
{
// Do something
}

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ subscribeWithBuffer()

override async Task RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.subscribeWithBuffer ( String  channel,
String  subscriberId,
OnMessageWithBufferDelegate  onMessage 
)
virtual

Subscribes to a channel with buffer.

Parameters
channelChannel name.
subscriberIdThe subscriber client identifier
onMessageOnMessageWithBufferDelegate callback.
ortcClient.subscribeWithBuffer("channelName", "SOME_ID", OnMessageCallback);
private void OnMessageCallback(object ortc, string channel, string seqId, string message)
{
// Do something
}

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ SubscribeWithFilter()

override async Task RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.SubscribeWithFilter ( String  channel,
Boolean  subscribeOnReconnect,
String  filter,
OnMessageWithFilterDelegate  onMessage 
)
virtual

Subscribe the specified channel in order to receive messages in that channel

Parameters
channelChannel name.
subscribeOnReconnectedSubscribe to the specified channel on reconnect.
filterIndicates the filter for this channel
onMessageOnMessageWithFilterDelegate callback.
ortcClient.SubscribeWithFilter("channelName", true, "message.a = 10", OnMessageCallback);
private void OnMessageCallback(object sender, string channel, bool filtered, string message)
{
// Do something
}

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ SubscribeWithOptions()

override async Task RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.SubscribeWithOptions ( Dictionary< string, object >  options,
OnMessageWithOptionsDelegate  onMessage 
)
virtual

Subscribes to a channel with given options.

Parameters
optionsChannel subscription options
subscribeOnReconnectedSubscribe to the specified channel on reconnect.
onMessageOnMessageWithOptionsDelegate callback.
"options = { channel,
subscribeOnReconnected, // optional, default = true,
withNotifications(Bool), // optional, default = false, use push notifications as in subscribeWithNotifications
filter, // optional, default = "", the subscription filter as in subscribeWithFilter
subscriberId // optional, default = "", the subscriberId as in subscribeWithBuffer
}"
ortcClient.SubscribeWithOptions(options, OnMessageCallback);
private void OnMessageCallback(object sender, Dictionary<string, object> msgOptions)
{
// Do something
}

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

◆ Unsubscribe()

override async Task RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.Unsubscribe ( string  channel)
virtual

Unsubscribes from a channel.

Parameters
channelChannel name.
ortcClient.Unsubscribe("channelName");

Reimplemented from RealtimeMessaging.DotNetCore.Extensibility.OrtcClient.

Event Documentation

◆ OnConnected

override OnConnectedDelegate RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.OnConnected

Occurs when a connection attempt was successful.

◆ OnDisconnected

override OnDisconnectedDelegate RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.OnDisconnected

Occurs when the client connection terminated.

◆ OnException

override OnExceptionDelegate RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.OnException

Occurs when there is an error.

◆ OnReconnected

override OnReconnectedDelegate RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.OnReconnected

Occurs when a client reconnected.

◆ OnReconnecting

override OnReconnectingDelegate RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.OnReconnecting

Occurs when a client attempts to reconnect.

◆ OnSubscribed

override OnSubscribedDelegate RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.OnSubscribed

Occurs when the client subscribed to a channel.

◆ OnUnsubscribed

override OnUnsubscribedDelegate RealtimeMessaging.DotNetCore.Plugin.RealTimeSJ.RealTimeSJClient.OnUnsubscribed

Occurs when the client unsubscribed from a channel.


The documentation for this class was generated from the following file: