Interface ISocketClient
Represents a basic SocketIO client to function with WolfClient.
Namespace: TehGM.Wolfringo.Socket
Assembly: Wolfringo.Core.dll
Syntax
public interface ISocketClient
Properties
| Improve this Doc View SourceIsConnected
Is the client currently connected?
Declaration
bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceConnectAsync(Uri, CancellationToken)
Connect the client to the server.
Declaration
Task ConnectAsync(Uri url, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | url | URL to connect to. |
System.Threading.CancellationToken | cancellationToken | Token which can be used to teminate the connection. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
DisconnectAsync(CancellationToken)
Disconnects the client from the server.
Declaration
Task DisconnectAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | Token which can be used to terminate socket closing handshake. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SendAsync(JToken, IEnumerable<Byte[]>, CancellationToken)
Sends (emits) event to the server.
Declaration
Task<uint> SendAsync(JToken payload, IEnumerable<byte[]> binaryMessages, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Newtonsoft.Json.Linq.JToken | payload | Json payload to send. |
System.Collections.Generic.IEnumerable<System.Byte[]> | binaryMessages | Collection of binary messages to send. |
System.Threading.CancellationToken | cancellationToken | Token which can be used to abort sending. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.UInt32> | ID of the sent message. |
Events
| Improve this Doc View SourceConnected
Rasied when the client connects to the server.
Declaration
event EventHandler Connected
Event Type
Type | Description |
---|---|
System.EventHandler |
Disconnected
Raised when the client disconnects from the server.
Declaration
event EventHandler<SocketClosedEventArgs> Disconnected
Event Type
Type | Description |
---|---|
System.EventHandler<SocketClosedEventArgs> |
ErrorRaised
Raised when an error has occured in client's internal connection loop.
Declaration
event EventHandler<UnhandledExceptionEventArgs> ErrorRaised
Event Type
Type | Description |
---|---|
System.EventHandler<System.UnhandledExceptionEventArgs> |
MessageReceived
Raised when the client has received a message.
Declaration
event EventHandler<SocketMessageEventArgs> MessageReceived
Event Type
Type | Description |
---|---|
System.EventHandler<SocketMessageEventArgs> |
MessageSent
Raised when the client has sent a message.
Declaration
event EventHandler<SocketMessageEventArgs> MessageSent
Event Type
Type | Description |
---|---|
System.EventHandler<SocketMessageEventArgs> |