Tanoda
HybridWebSocket.WebSocket Class Reference
Inheritance diagram for HybridWebSocket.WebSocket:
HybridWebSocket.IWebSocket

Public Member Functions

 WebSocket (string url)
 WebSocket constructor. More...
 
void Connect ()
 Open WebSocket connection More...
 
void Close (WebSocketCloseCode code=WebSocketCloseCode.Normal, string reason=null)
 Close WebSocket connection with optional status code and reason. More...
 
void Send (byte[] data)
 Send binary data over the socket. More...
 
void Send (string data)
 Send text data over the socket. More...
 
bool Ping ()
 Trys to ping the host. More...
 
WebSocketState GetState ()
 Return WebSocket connection state. More...
 
void Connect ()
 Open WebSocket connection More...
 
void Close (WebSocketCloseCode code=WebSocketCloseCode.Normal, string reason=null)
 Close WebSocket connection with optional status code and reason. More...
 
void Send (byte[] data)
 Send binary data over the socket. More...
 
WebSocketState GetState ()
 Return WebSocket connection state. More...
 

Protected Attributes

WebSocketSharp.WebSocket ws
 The WebSocketSharp instance. More...
 

Events

WebSocketOpenEventHandler OnOpen
 Occurs when the connection is opened. More...
 
WebSocketMessageEventHandler OnMessage
 Occurs when a message is received. More...
 
WebSocketErrorEventHandler OnError
 Occurs when an error was reported from WebSocket. More...
 
WebSocketCloseEventHandler OnClose
 Occurs when the socked was closed. More...
 
- Events inherited from HybridWebSocket.IWebSocket
WebSocketOpenEventHandler OnOpen
 Occurs when the connection is opened. More...
 
WebSocketMessageEventHandler OnMessage
 Occurs when a message is received. More...
 
WebSocketErrorEventHandler OnError
 Occurs when an error was reported from WebSocket. More...
 
WebSocketCloseEventHandler OnClose
 Occurs when the socked was closed. More...
 

Detailed Description

Definition at line 443 of file WebSocket.cs.

Constructor & Destructor Documentation

◆ WebSocket()

HybridWebSocket.WebSocket.WebSocket ( string  url)

WebSocket constructor.

Parameters
urlValid WebSocket URL.

Definition at line 475 of file WebSocket.cs.

Member Function Documentation

◆ Close()

void HybridWebSocket.WebSocket.Close ( WebSocketCloseCode  code = WebSocketCloseCode.Normal,
string  reason = null 
)

Close WebSocket connection with optional status code and reason.

Parameters
codeClose status code.
reasonReason string.

Implements HybridWebSocket.IWebSocket.

Definition at line 555 of file WebSocket.cs.

◆ Connect()

void HybridWebSocket.WebSocket.Connect ( )

Open WebSocket connection

Implements HybridWebSocket.IWebSocket.

Definition at line 532 of file WebSocket.cs.

◆ GetState()

WebSocketState HybridWebSocket.WebSocket.GetState ( )

Return WebSocket connection state.

Returns
The state.

Implements HybridWebSocket.IWebSocket.

Definition at line 644 of file WebSocket.cs.

◆ Ping()

bool HybridWebSocket.WebSocket.Ping ( )

Trys to ping the host.

Definition at line 623 of file WebSocket.cs.

◆ Send() [1/2]

void HybridWebSocket.WebSocket.Send ( byte[]  data)

Send binary data over the socket.

Parameters
dataPayload data.

Implements HybridWebSocket.IWebSocket.

Definition at line 580 of file WebSocket.cs.

◆ Send() [2/2]

void HybridWebSocket.WebSocket.Send ( string  data)

Send text data over the socket.

Parameters
dataPayload text.

Definition at line 602 of file WebSocket.cs.

Member Data Documentation

◆ ws

WebSocketSharp.WebSocket HybridWebSocket.WebSocket.ws
protected

The WebSocketSharp instance.

Definition at line 469 of file WebSocket.cs.

Event Documentation

◆ OnClose

WebSocketCloseEventHandler HybridWebSocket.WebSocket.OnClose

Occurs when the socked was closed.

Definition at line 464 of file WebSocket.cs.

◆ OnError

WebSocketErrorEventHandler HybridWebSocket.WebSocket.OnError

Occurs when an error was reported from WebSocket.

Definition at line 459 of file WebSocket.cs.

◆ OnMessage

WebSocketMessageEventHandler HybridWebSocket.WebSocket.OnMessage

Occurs when a message is received.

Definition at line 454 of file WebSocket.cs.

◆ OnOpen

WebSocketOpenEventHandler HybridWebSocket.WebSocket.OnOpen

Occurs when the connection is opened.

Definition at line 449 of file WebSocket.cs.


The documentation for this class was generated from the following file: