Search Results for

    Show / Hide Table of Contents

    Class Client

    A LiveSwitch client.

    Inheritance
    System.Object
    Serializable
    Dynamic
    Client
    Inherited Members
    Dynamic.DynamicProperties
    Dynamic.GetDynamicValue(String)
    Dynamic.SetDynamicValue(String, Object)
    Dynamic.UnsetDynamicValue(String)
    Serializable.IsDirty
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: FM.LiveSwitch
    Assembly: FM.LiveSwitch.dll
    Syntax
    public class Client : Dynamic

    Constructors

    Client(String, String)

    Initializes a new instance of the Client class.

    Declaration
    public Client(string gatewayUrl, string applicationId)
    Parameters
    Type Name Description
    System.String gatewayUrl

    The gateway URL.

    System.String applicationId

    The application identifier.

    Client(String, String, String)

    Initializes a new instance of the Client class.

    Declaration
    public Client(string gatewayUrl, string applicationId, string userId)
    Parameters
    Type Name Description
    System.String gatewayUrl

    The gateway URL.

    System.String applicationId

    The application identifier.

    System.String userId

    The user identifier, or null to auto-generate.

    Client(String, String, String, String)

    Initializes a new instance of the Client class.

    Declaration
    public Client(string gatewayUrl, string applicationId, string userId, string deviceId)
    Parameters
    Type Name Description
    System.String gatewayUrl

    The gateway URL.

    System.String applicationId

    The application identifier.

    System.String userId

    The user identifier, or null to auto-generate.

    System.String deviceId

    The device identifier, or null to auto-generate.

    Client(String, String, String, String, String)

    Initializes a new instance of the Client class.

    Declaration
    public Client(string gatewayUrl, string applicationId, string userId, string deviceId, string clientId)
    Parameters
    Type Name Description
    System.String gatewayUrl

    The gateway URL.

    System.String applicationId

    The application identifier.

    System.String userId

    The user identifier, or null to auto-generate.

    System.String deviceId

    The device identifier, or null to auto-generate.

    System.String clientId

    The client identifier, or null to auto-generate.

    Client(String, String, String, String, String, String[])

    Initializes a new instance of the Client class.

    Declaration
    public Client(string gatewayUrl, string applicationId, string userId, string deviceId, string clientId, string[] roles)
    Parameters
    Type Name Description
    System.String gatewayUrl

    The gateway URL.

    System.String applicationId

    The application identifier.

    System.String userId

    The user identifier, or null to auto-generate.

    System.String deviceId

    The device identifier, or null to auto-generate.

    System.String clientId

    The client identifier, or null to auto-generate.

    System.String[] roles

    The roles, if any.

    Client(String, String, String, String, String, String[], String)

    Initializes a new instance of the Client class.

    Declaration
    public Client(string gatewayUrl, string applicationId, string userId, string deviceId, string clientId, string[] roles, string region)
    Parameters
    Type Name Description
    System.String gatewayUrl

    The gateway URL.

    System.String applicationId

    The application identifier.

    System.String userId

    The user identifier, or null to auto-generate.

    System.String deviceId

    The device identifier, or null to auto-generate.

    System.String clientId

    The client identifier, or null to auto-generate.

    System.String[] roles

    The roles, if any.

    System.String region

    The region, if any.

    Properties

    ApplicationId

    Gets the application identifier.

    Declaration
    public string ApplicationId { get; }
    Property Value
    Type Description
    System.String

    Channels

    Gets an array of joined channels.

    Declaration
    public Channel[] Channels { get; }
    Property Value
    Type Description
    Channel[]

    Config

    Gets the current configuration.

    Declaration
    public ClientConfig Config { get; }
    Property Value
    Type Description
    ClientConfig

    DeviceAlias

    Gets or sets the device alias. Cannot be set after registration, use the 'Update' method instead.

    Declaration
    public string DeviceAlias { get; set; }
    Property Value
    Type Description
    System.String

    DeviceId

    Gets the device identifier.

    Declaration
    public string DeviceId { get; }
    Property Value
    Type Description
    System.String

    DisableWebSockets

    Gets or sets whether to disable WebSocket protocol support and use long-polling, even if the server is capable of accepting WebSocket requests.

    Declaration
    public bool DisableWebSockets { get; set; }
    Property Value
    Type Description
    System.Boolean

    ExternalId

    Gets or sets the external client identifier.

    Declaration
    public string ExternalId { get; set; }
    Property Value
    Type Description
    System.String

    GatewayUrl

    Gets the gateway URL.

    Declaration
    public string GatewayUrl { get; }
    Property Value
    Type Description
    System.String

    Id

    Gets the client identifier.

    Declaration
    public string Id { get; }
    Property Value
    Type Description
    System.String

    Info

    Gets the client info.

    Declaration
    public ClientInfo Info { get; }
    Property Value
    Type Description
    ClientInfo

    MessageBytesReceived

    Gets the number of message bytes received.

    Declaration
    public long MessageBytesReceived { get; }
    Property Value
    Type Description
    System.Int64

    MessageBytesSent

    Gets the number of message bytes sent.

    Declaration
    public long MessageBytesSent { get; }
    Property Value
    Type Description
    System.Int64

    MessagesReceived

    Gets the number of messages received.

    Declaration
    public long MessagesReceived { get; }
    Property Value
    Type Description
    System.Int64

    MessagesSent

    Gets the number of messages sent.

    Declaration
    public long MessagesSent { get; }
    Property Value
    Type Description
    System.Int64

    Region

    Gets the region.

    Declaration
    public string Region { get; }
    Property Value
    Type Description
    System.String

    RequestMaxRetries

    Gets or sets the maximum number of retries allowed for a standard request.

    Declaration
    public int RequestMaxRetries { get; set; }
    Property Value
    Type Description
    System.Int32

    RequestTimeout

    Gets or sets the number of milliseconds to wait for a standard request to return a response before it is aborted and another request is attempted. Defaults to 15000 (15 seconds).

    Declaration
    public int RequestTimeout { get; set; }
    Property Value
    Type Description
    System.Int32

    Roles

    Gets the roles.

    Declaration
    public string[] Roles { get; }
    Property Value
    Type Description
    System.String[]

    State

    Gets the state.

    Declaration
    public ClientState State { get; }
    Property Value
    Type Description
    ClientState

    Tag

    Gets or sets the tag. Cannot be set after registration, use the 'Update' method instead.

    Declaration
    public string Tag { get; set; }
    Property Value
    Type Description
    System.String

    UnregisterException

    Gets the unregister exception, which is set if registration is reset abnormally.

    Declaration
    public Exception UnregisterException { get; }
    Property Value
    Type Description
    System.Exception

    UserAlias

    Gets or sets the user alias. Cannot be set after registration, use the 'Update' method instead.

    Declaration
    public string UserAlias { get; set; }
    Property Value
    Type Description
    System.String

    UserId

    Gets the user identifier.

    Declaration
    public string UserId { get; }
    Property Value
    Type Description
    System.String

    Methods

    CloseAll()

    Closes all active connections in all channels.

    Declaration
    public Future<object> CloseAll()
    Returns
    Type Description
    Future<System.Object>

    Join(String)

    Joins a channel.

    Declaration
    public Future<Channel> Join(string token)
    Parameters
    Type Name Description
    System.String token

    The auth token.

    Returns
    Type Description
    Future<Channel>

    A future with the joined channel.

    Join(String, String)

    Joins a channel.

    Declaration
    public Future<Channel> Join(string channelId, string token)
    Parameters
    Type Name Description
    System.String channelId

    The channel identifier.

    System.String token

    The auth token.

    Returns
    Type Description
    Future<Channel>

    A future with the joined channel.

    Leave(String)

    Leaves a channel.

    Declaration
    public Future<Channel> Leave(string channelId)
    Parameters
    Type Name Description
    System.String channelId

    The channel identifier.

    Returns
    Type Description
    Future<Channel>

    Register(String)

    Registers with the signalling server.

    Declaration
    public Future<Channel[]> Register(string token)
    Parameters
    Type Name Description
    System.String token

    The auth token.

    Returns
    Type Description
    Future<Channel[]>

    A future with an array of initial channels as instructed by the auth token.

    SendMessage(String)

    Sends a message to the server with no delivery.

    Declaration
    public Future<object> SendMessage(string message)
    Parameters
    Type Name Description
    System.String message

    The message to be sent.

    Returns
    Type Description
    Future<System.Object>

    Unregister()

    Unregisters with the signalling server.

    Declaration
    public Future<object> Unregister()
    Returns
    Type Description
    Future<System.Object>

    A future that resolves when successfully unregistered.

    Update(ClientConfig)

    Updates this client.

    Declaration
    public Future<object> Update(ClientConfig clientConfig)
    Parameters
    Type Name Description
    ClientConfig clientConfig

    The client configuration.

    Returns
    Type Description
    Future<System.Object>

    A future that resolves when the client has been updated.

    Events

    OnApplicationMessage

    Raised when an application-scope message is received from the server. Parameters:

    • clientInfo - the sending client information
    • message - the message
    Declaration
    public event Action2<ClientInfo, string> OnApplicationMessage
    Event Type
    Type Description
    Action2<ClientInfo, System.String>

    OnDeviceMessage

    Raised when a device-scope message is received from the server. Parameters:

    • clientInfo - the sending client information
    • message - the message
    Declaration
    public event Action2<ClientInfo, string> OnDeviceMessage
    Event Type
    Type Description
    Action2<ClientInfo, System.String>

    OnHttpRequestCreated

    Raised whenever an underlying HTTP request has been created and is about to be transferred to the server. This is a good place to add headers/cookies. For WebSocket streams, this will fire only once for the initial HTTP-based handshake.

    Declaration
    public event Action1<HttpRequestCreatedArgs> OnHttpRequestCreated
    Event Type
    Type Description
    Action1<HttpRequestCreatedArgs>

    OnHttpResponseReceived

    Raised whenever an underlying HTTP response has been received and is about to be processed by the client. This is a good place to read headers/cookies. For WebSocket streams, this will fire only once for the initial HTTP-based handshake.

    Declaration
    public event Action1<HttpResponseReceivedArgs> OnHttpResponseReceived
    Event Type
    Type Description
    Action1<HttpResponseReceivedArgs>

    OnMessage

    Raised when a client-scope message is received from the server. Parameters:

    • clientInfo - the sending client information
    • message - the message
    Declaration
    public event Action2<ClientInfo, string> OnMessage
    Event Type
    Type Description
    Action2<ClientInfo, System.String>

    OnRemoteUpdate

    Raised when the the client's config on the server has changed.

    Declaration
    public event Action2<ClientInfo, ClientInfo> OnRemoteUpdate
    Event Type
    Type Description
    Action2<ClientInfo, ClientInfo>

    OnStateChange

    Raised when the state changes.

    Declaration
    public event Action1<Client> OnStateChange
    Event Type
    Type Description
    Action1<Client>

    OnStreamChange

    Raised whenever a client disconnects or reconnects to the internet.

    Declaration
    public event Action1<NetworkConnectionState> OnStreamChange
    Event Type
    Type Description
    Action1<NetworkConnectionState>

    OnUserMessage

    Raised when a user-scope message is received from the server. Parameters:

    • clientInfo - the sending client information
    • message - the message
    Declaration
    public event Action2<ClientInfo, string> OnUserMessage
    Event Type
    Type Description
    Action2<ClientInfo, System.String>
    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.16.3