Class SocketClient
Basic SocketIO client designed for use with Wolfringo.
Inheritance
Namespace: TehGM.Wolfringo.Socket
Assembly: Wolfringo.Core.dll
Syntax
public class SocketClient : ISocketClient, IDisposable
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
Properties
| Improve this Doc View SourceIsConnected
Is the client currently connected?
Declaration
public bool IsConnected { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
MessageEncoding
Encoding to use when sending and receiving messages. Defaults to UTF8.
Declaration
public Encoding MessageEncoding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Text.Encoding |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
Session
Session info for the connection.
Declaration
public SocketSession Session { get; }
Property Value
| Type | Description |
|---|---|
| SocketSession |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
Methods
| Improve this Doc View SourceConnectAsync(Uri, CancellationToken)
Connect the client to the server.
Declaration
public async 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 |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
DisconnectAsync(CancellationToken)
Disconnects the client from the server.
Declaration
public 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 |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
Dispose()
Disposes the resources used by this client.
Declaration
public void Dispose()
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
SendAsync(JToken, IEnumerable<Byte[]>, CancellationToken)
Sends (emits) event to the server.
Declaration
public Task<uint> SendAsync(JToken payload, IEnumerable<byte[]> binaryMessages, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| 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. |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
Events
| Improve this Doc View SourceConnected
Rasied when the client connects to the server.
Declaration
public event EventHandler Connected
Event Type
| Type | Description |
|---|---|
| System.EventHandler |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
Disconnected
Raised when the client disconnects from the server.
Declaration
public event EventHandler<SocketClosedEventArgs> Disconnected
Event Type
| Type | Description |
|---|---|
| System.EventHandler<SocketClosedEventArgs> |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
ErrorRaised
Raised when an error has occured in client's internal connection loop.
Declaration
public event EventHandler<UnhandledExceptionEventArgs> ErrorRaised
Event Type
| Type | Description |
|---|---|
| System.EventHandler<System.UnhandledExceptionEventArgs> |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
MessageReceived
Raised when the client has received a message.
Declaration
public event EventHandler<SocketMessageEventArgs> MessageReceived
Event Type
| Type | Description |
|---|---|
| System.EventHandler<SocketMessageEventArgs> |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.
MessageSent
Raised when the client has sent a message.
Declaration
public event EventHandler<SocketMessageEventArgs> MessageSent
Event Type
| Type | Description |
|---|---|
| System.EventHandler<SocketMessageEventArgs> |
Remarks
This client only supports features required to use with Wolf. For this reason, some SocketIO behaviours may not be supported, while others function in a Wolf-specific way.
If you wish to support other behaviours, write own ISocketClient.
This socket client will automatically handle pinging and SID message. It is not needed to handle these behaviours manually.