Interface IWolfClient
A Wolf client.
Namespace: TehGM.Wolfringo
Assembly: Wolfringo.Core.dll
Syntax
public interface IWolfClient
Properties
| Improve this Doc View SourceCurrentUserID
Currently logged in user. Null if not connected.
Declaration
uint? CurrentUserID { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.UInt32> |
Methods
| Improve this Doc View SourceAddMessageListener(IMessageCallback)
Adds event listener.
Declaration
void AddMessageListener(IMessageCallback listener)
Parameters
Type | Name | Description |
---|---|---|
IMessageCallback | listener | Callback to invoke on event. |
ConnectAsync(CancellationToken)
Connects to the server.
Declaration
Task ConnectAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | Token to abort entire connection. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
DisconnectAsync(CancellationToken)
Disconnects from the server.
Declaration
Task DisconnectAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
RemoveMessageListener(IMessageCallback)
Removes event listener.
Declaration
void RemoveMessageListener(IMessageCallback listener)
Parameters
Type | Name | Description |
---|---|---|
IMessageCallback | listener | Callback to remove. |
SendAsync<TResponse>(IWolfMessage, CancellationToken)
Sends message, and waits for response from the server.
Declaration
Task<TResponse> SendAsync<TResponse>(IWolfMessage message, CancellationToken cancellationToken = default(CancellationToken))
where TResponse : IWolfResponse
Parameters
Type | Name | Description |
---|---|---|
IWolfMessage | message | Message to send. |
System.Threading.CancellationToken | cancellationToken | Cancellation token that can be used for Task cancellation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResponse> | Sending response. |
Type Parameters
Name | Description |
---|---|
TResponse | Response type to use for casting of response. |
Remarks
If client uses ResponseTypeResolver, the type of response provided with
ResponseTypeAttribute on message
will be used for deserialization,
and TResponse
will be used only for casting. If ResponseTypeAttribute is not set on
message
, TResponse
will be used for deserialization as normal.
Exceptions
Type | Condition |
---|---|
MessageSendingException | Server responded with error. |
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 Disconnected
Event Type
Type | Description |
---|---|
System.EventHandler |
ErrorRaised
Raised when an error has occured.
Declaration
event EventHandler<UnhandledExceptionEventArgs> ErrorRaised
Event Type
Type | Description |
---|---|
System.EventHandler<System.UnhandledExceptionEventArgs> |
MessageReceived
Raised when the client receives an event from the server.
Declaration
event EventHandler<WolfMessageEventArgs> MessageReceived
Event Type
Type | Description |
---|---|
System.EventHandler<WolfMessageEventArgs> |
MessageSent
Raised when the client sends a message to the server.
Declaration
event EventHandler<WolfMessageSentEventArgs> MessageSent
Event Type
Type | Description |
---|---|
System.EventHandler<WolfMessageSentEventArgs> |