C# 클래스 DeviceHive.Client.WebSocketChannel

Represents implementation of the persistent connection to the DeviceHive server using WebSocket API.
상속: Channel
파일 보기 프로젝트 열기: devicehive/devicehive-.net

공개 메소드들

메소드 설명
CanConnectAsync ( ) : Task

Checks if current channel object can be used to eshtablish connection to the DeviceHive server. The method returns true only if the DeviceHive server deployment supports WebSocket protocol.

CloseAsync ( ) : Task

Closes the persistent connection to the DeviceHive server.

OpenAsync ( ) : Task

Opens a persistent connection to the DeviceHive server.

SendCommandAsync ( string deviceGuid, Command command, Action callback = null, CancellationToken token = null ) : Task

Sends a command to the device.

SendNotificationAsync ( string deviceGuid, Notification notification ) : Task

Sends a notification on behalf of device.

UpdateCommandAsync ( string deviceGuid, Command command ) : Task

Updates a command on behalf of the device.

WaitCommandResultAsync ( string deviceGuid, int commandId, CancellationToken token = null ) : Task

Waits until the command is completed and returns a Command object with filled Status and Result properties.

WebSocketChannel ( DeviceHive.Client.DeviceHiveConnectionInfo connectionInfo ) : Newtonsoft.Json.Linq

Default constructor.

WebSocketChannel ( DeviceHive.Client.DeviceHiveConnectionInfo connectionInfo, IRestClient restClient ) : Newtonsoft.Json.Linq

Constructor which allows to override IRestClient which makes HTTP requests to the DeviceHive server.

보호된 메소드들

메소드 설명
SubscriptionAdding ( ISubscription subscription ) : Task

Invoked before new subscription is added. The methods sends subscribe message to the DeviceHive server.

SubscriptionRemoving ( ISubscription subscription ) : Task

Invoked before an existing subscription is removed. The methods sends unsubscribe message to the DeviceHive server.

비공개 메소드들

메소드 설명
AuthenticateAsync ( ) : Task
HandleConnectionClose ( ) : void
HandleMessage ( MessageWebSocketMessageReceivedEventArgs args ) : void
HandleMessage ( string message ) : void
OpenWebSocketAsync ( ) : Task
Reconnect ( ) : Task
SendRequestAsync ( string action ) : Task

메소드 상세

CanConnectAsync() 공개 메소드

Checks if current channel object can be used to eshtablish connection to the DeviceHive server. The method returns true only if the DeviceHive server deployment supports WebSocket protocol.
public CanConnectAsync ( ) : Task
리턴 Task

CloseAsync() 공개 메소드

Closes the persistent connection to the DeviceHive server.
public CloseAsync ( ) : Task
리턴 Task

OpenAsync() 공개 메소드

Opens a persistent connection to the DeviceHive server.
public OpenAsync ( ) : Task
리턴 Task

SendCommandAsync() 공개 메소드

Sends a command to the device.
public SendCommandAsync ( string deviceGuid, Command command, Action callback = null, CancellationToken token = null ) : Task
deviceGuid string Device unique identifier.
command Command A object to be sent.
callback Action A callback action to invoke when the command is completed by the device.
token System.Threading.CancellationToken Cancellation token to cancel waiting for command result.
리턴 Task

SendNotificationAsync() 공개 메소드

Sends a notification on behalf of device.
public SendNotificationAsync ( string deviceGuid, Notification notification ) : Task
deviceGuid string Device unique identifier.
notification Notification A object to be sent.
리턴 Task

SubscriptionAdding() 보호된 메소드

Invoked before new subscription is added. The methods sends subscribe message to the DeviceHive server.
protected SubscriptionAdding ( ISubscription subscription ) : Task
subscription ISubscription A object representing a subscription.
리턴 Task

SubscriptionRemoving() 보호된 메소드

Invoked before an existing subscription is removed. The methods sends unsubscribe message to the DeviceHive server.
protected SubscriptionRemoving ( ISubscription subscription ) : Task
subscription ISubscription A object representing a subscription.
리턴 Task

UpdateCommandAsync() 공개 메소드

Updates a command on behalf of the device.
public UpdateCommandAsync ( string deviceGuid, Command command ) : Task
deviceGuid string Device unique identifier.
command Command A object to update.
리턴 Task

WaitCommandResultAsync() 공개 메소드

Waits until the command is completed and returns a Command object with filled Status and Result properties.
public WaitCommandResultAsync ( string deviceGuid, int commandId, CancellationToken token = null ) : Task
deviceGuid string Device unique identifier.
commandId int Command identifier.
token System.Threading.CancellationToken Cancellation token to cancel waiting for command result.
리턴 Task

WebSocketChannel() 공개 메소드

Default constructor.
public WebSocketChannel ( DeviceHive.Client.DeviceHiveConnectionInfo connectionInfo ) : Newtonsoft.Json.Linq
connectionInfo DeviceHive.Client.DeviceHiveConnectionInfo DeviceHive connection information.
리턴 Newtonsoft.Json.Linq

WebSocketChannel() 공개 메소드

Constructor which allows to override IRestClient which makes HTTP requests to the DeviceHive server.
public WebSocketChannel ( DeviceHive.Client.DeviceHiveConnectionInfo connectionInfo, IRestClient restClient ) : Newtonsoft.Json.Linq
connectionInfo DeviceHive.Client.DeviceHiveConnectionInfo DeviceHive connection information.
restClient IRestClient IRestClient implementation.
리턴 Newtonsoft.Json.Linq