Interface IServiceMessagingClient
Interface for a messaging client used to connect to a service and send/receive messages
Namespace: Unity.Cloud.Common
Syntax
public interface IServiceMessagingClient
Properties
State
Reference to the current state of the connection
Declaration
ConnectionState State { get; }
Property Value
Type | Description |
---|---|
ConnectionState |
Methods
AddApiSourceVersion(String, String)
Adds an ApiSourceVersion to the client.
Declaration
void AddApiSourceVersion(string name, string version)
Parameters
Type | Name | Description |
---|---|---|
String | name | The API source name. |
String | version | The API source version. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown is |
AddApiSourceVersion(ApiSourceVersion)
Adds an ApiSourceVersion to the client.
Declaration
void AddApiSourceVersion(ApiSourceVersion apiSourceVersion)
Parameters
Type | Name | Description |
---|---|---|
ApiSourceVersion | apiSourceVersion | The version information for the API using this client. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ConnectAsync(Uri, ServiceMessagingClientOptions, CancellationToken)
Awaitable method to open a connection to a service using the given url using messaging client options
Declaration
Task ConnectAsync(Uri uri, ServiceMessagingClientOptions options = default(ServiceMessagingClientOptions), CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | Uri |
ServiceMessagingClientOptions | options | The selected options |
CancellationToken | cancellationToken | Optional cancellation token that will try to cancel the operation. |
Returns
Type | Description |
---|---|
Task |
DisconnectAsync()
Awaitable method to close a connection to a server
Declaration
Task DisconnectAsync()
Returns
Type | Description |
---|---|
Task |
SendAsync(IEnumerable<Message>)
Awaitable method to send a collection of messages to a server
Declaration
Task SendAsync(IEnumerable<Message> messages)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Message> | messages |
Returns
Type | Description |
---|---|
Task |
SendAsync(Message)
Awaitable method to send a message to a server
Declaration
Task SendAsync(Message message)
Parameters
Type | Name | Description |
---|---|---|
Message | message |
Returns
Type | Description |
---|---|
Task |
Events
ConnectionErrorOccured
Event invoked when a connection error occurs
Declaration
event Action<Exception> ConnectionErrorOccured
Event Type
Type | Description |
---|---|
Action<Exception> |
ConnectionStateChanged
Event invoked when the client's connection state changes
Declaration
event Action<ConnectionState> ConnectionStateChanged
Event Type
Type | Description |
---|---|
Action<ConnectionState> |
MessageReceived
Event invoked when a message is received from the server
Declaration
event Action<Message> MessageReceived
Event Type
Type | Description |
---|---|
Action<Message> |