C# 클래스 SocketIOClient.Client

Class to emulate socket.io javascript client capabilities for .net classes
Connection for wss or https urls
상속: IDisposable, SocketIOClient.IClient
파일 보기 프로젝트 열기: uken/UnitySocketIO-WebSocketSharp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
ConnectionOpenEvent System.Threading.ManualResetEvent
LastErrorMessage string
MessageQueueEmptyEvent System.Threading.ManualResetEvent
MessageQueuePendingEvent System.Threading.ManualResetEvent

보호된 프로퍼티들

프로퍼티 타입 설명
registrationManager RegistrationManager
uri Uri
wsClient WebSocket

공개 메소드들

메소드 설명
Client ( string url ) : System
Close ( ) : void

Close SocketIO4Net.Client and clear all event registrations

Connect ( string endPoint ) : IEndPointClient
Connect ( ) : void

Initiate the connection with Socket.IO service

Dispose ( ) : void
Emit ( string eventName, Object payload ) : void

Asynchronously sends payload using eventName

payload must a string or Json Serializable

Mimicks Socket.IO client 'socket.emit('name',payload);' pattern

Do not use the reserved socket.io event names: connect, disconnect, open, close, error, retry, reconnect

Emit ( string eventName, Object payload, string endPoint, Action callback ) : void

Asynchronously sends payload using eventName

payload must a string or Json Serializable

Mimicks Socket.IO client 'socket.emit('name',payload);' pattern

Do not use the reserved socket.io event names: connect, disconnect, open, close, error, retry, reconnect

ArgumentOutOfRangeException will be thrown on reserved event names

On ( string eventName, Action action ) : void

Asynchronously calls the action delegate on event message notification

Mimicks the Socket.IO client 'socket.on('name',function(data){});' pattern

Reserved socket.io event names available: connect, disconnect, open, close, error, retry, reconnect

On ( string eventName, string endPoint, Action action ) : void
Send ( IMessage msg ) : void

Queue outbound message

Send ( string msg ) : void

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void
OnConnectionRetryAttemptEvent ( object sender, EventArgs e ) : void
OnErrorEvent ( object sender, ErrorEventArgs e ) : void
OnHeartBeatTimerCallback ( object state ) : void
OnMessageEvent ( IMessage msg ) : void

if a registerd event name is found, don't raise the more generic Message event

OnSocketConnectionClosedEvent ( object sender, EventArgs e ) : void
ReConnect ( ) : void
closeHeartBeatTimer ( ) : void
closeOutboundQueue ( ) : void
closeWebSocketClient ( ) : void
dequeuOutboundMessages ( ) : void

While connection is open, dequeue and send messages to the socket server

requestHandshake ( Uri uri, DownloadStringCompletedEventHandler handshakeCallback ) : void

Client performs an initial HTTP POST to obtain a SessionId (sid) assigned to a client, followed by the heartbeat timeout, connection closing timeout, and the list of supported transports.

The tansport and sid are required as part of the ws: transport connection

비공개 메소드들

메소드 설명
EndAsyncEvent ( IAsyncResult result ) : void
HandshakeCallback ( object sender, DownloadStringCompletedEventArgs eventArgs ) : void
Send_backup ( string rawEncodedMessageText ) : void
wsClient_Closed ( object sender, WebSocketSharp e ) : void

websocket has closed unexpectedly - retry connection

wsClient_Error ( object sender, WebSocketSharp e ) : void
wsClient_MessageReceived ( object sender, WebSocketSharp e ) : void

Raw websocket messages from server - convert to message types and call subscribers of events and/or callbacks

wsClient_OpenEvent ( object sender, EventArgs e ) : void

메소드 상세

Client() 공개 메소드

public Client ( string url ) : System
url string
리턴 System

Close() 공개 메소드

Close SocketIO4Net.Client and clear all event registrations
public Close ( ) : void
리턴 void

Connect() 공개 메소드

public Connect ( string endPoint ) : IEndPointClient
endPoint string
리턴 IEndPointClient

Connect() 공개 메소드

Initiate the connection with Socket.IO service
public Connect ( ) : void
리턴 void

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

Emit() 공개 메소드

Asynchronously sends payload using eventName

payload must a string or Json Serializable

Mimicks Socket.IO client 'socket.emit('name',payload);' pattern

Do not use the reserved socket.io event names: connect, disconnect, open, close, error, retry, reconnect

public Emit ( string eventName, Object payload ) : void
eventName string
payload Object must be a string or a Json Serializable object
리턴 void

Emit() 공개 메소드

Asynchronously sends payload using eventName

payload must a string or Json Serializable

Mimicks Socket.IO client 'socket.emit('name',payload);' pattern

Do not use the reserved socket.io event names: connect, disconnect, open, close, error, retry, reconnect

ArgumentOutOfRangeException will be thrown on reserved event names
public Emit ( string eventName, Object payload, string endPoint, Action callback ) : void
eventName string
payload Object must be a string or a Json Serializable object
endPoint string
callback Action
리턴 void

On() 공개 메소드

Asynchronously calls the action delegate on event message notification

Mimicks the Socket.IO client 'socket.on('name',function(data){});' pattern

Reserved socket.io event names available: connect, disconnect, open, close, error, retry, reconnect

public On ( string eventName, Action action ) : void
eventName string
action Action
리턴 void

On() 공개 메소드

public On ( string eventName, string endPoint, Action action ) : void
eventName string
endPoint string
action Action
리턴 void

OnConnectionRetryAttemptEvent() 보호된 메소드

protected OnConnectionRetryAttemptEvent ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
리턴 void

OnErrorEvent() 보호된 메소드

protected OnErrorEvent ( object sender, ErrorEventArgs e ) : void
sender object
e ErrorEventArgs
리턴 void

OnHeartBeatTimerCallback() 보호된 메소드

protected OnHeartBeatTimerCallback ( object state ) : void
state object
리턴 void

OnMessageEvent() 보호된 메소드

if a registerd event name is found, don't raise the more generic Message event
protected OnMessageEvent ( IMessage msg ) : void
msg IMessage
리턴 void

OnSocketConnectionClosedEvent() 보호된 메소드

protected OnSocketConnectionClosedEvent ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
리턴 void

ReConnect() 보호된 메소드

protected ReConnect ( ) : void
리턴 void

Send() 공개 메소드

Queue outbound message
public Send ( IMessage msg ) : void
msg IMessage
리턴 void

Send() 공개 메소드

public Send ( string msg ) : void
msg string
리턴 void

closeHeartBeatTimer() 보호된 메소드

protected closeHeartBeatTimer ( ) : void
리턴 void

closeOutboundQueue() 보호된 메소드

protected closeOutboundQueue ( ) : void
리턴 void

closeWebSocketClient() 보호된 메소드

protected closeWebSocketClient ( ) : void
리턴 void

dequeuOutboundMessages() 보호된 메소드

While connection is open, dequeue and send messages to the socket server
protected dequeuOutboundMessages ( ) : void
리턴 void

requestHandshake() 보호된 메소드

Client performs an initial HTTP POST to obtain a SessionId (sid) assigned to a client, followed by the heartbeat timeout, connection closing timeout, and the list of supported transports.

The tansport and sid are required as part of the ws: transport connection

protected requestHandshake ( Uri uri, DownloadStringCompletedEventHandler handshakeCallback ) : void
uri Uri http://localhost:3000
handshakeCallback DownloadStringCompletedEventHandler
리턴 void

프로퍼티 상세

ConnectionOpenEvent 공개적으로 프로퍼티

Connection Open Event
public ManualResetEvent,System.Threading ConnectionOpenEvent
리턴 System.Threading.ManualResetEvent

LastErrorMessage 공개적으로 프로퍼티

Value of the last error message text
public string LastErrorMessage
리턴 string

MessageQueueEmptyEvent 공개적으로 프로퍼티

ResetEvent for Outbound MessageQueue Empty Event - all pending messages have been sent
public ManualResetEvent,System.Threading MessageQueueEmptyEvent
리턴 System.Threading.ManualResetEvent

MessageQueuePendingEvent 공개적으로 프로퍼티

ResetEvent for Outbound MessageQueue Pending Messages Event - there are pending messages ready to send
public ManualResetEvent,System.Threading MessageQueuePendingEvent
리턴 System.Threading.ManualResetEvent

registrationManager 보호되어 있는 프로퍼티

RegistrationManager for dynamic events
protected RegistrationManager registrationManager
리턴 RegistrationManager

uri 보호되어 있는 프로퍼티

Uri of Websocket server
protected Uri uri
리턴 Uri

wsClient 보호되어 있는 프로퍼티

Underlying WebSocket implementation
protected WebSocket wsClient
리턴 WebSocket