Interface IHandler
Provides an interface for handling communication over the WebSocket connection.
public interface IHandler
Methods
CreateBinaryFrame(byte[])
Creates a frame for binary messages in the WebSocket protocol.
byte[] CreateBinaryFrame(byte[] frameData)
Parameters
frameData
byte[]The binary data of the message.
Returns
- byte[]
A byte array containing the message frame.
CreateCloseFrame(int)
Creates a frame for close messages in the WebSocket protocol.
byte[] CreateCloseFrame(int code)
Parameters
code
intThe connection close code of the message.
Returns
- byte[]
A byte array containing the message frame.
CreateHandshake()
Creates a handshake message for initiating connections.
byte[] CreateHandshake()
Returns
- byte[]
A byte array containing the handshake message.
CreateTextFrame(string)
Creates a frame for text messages in the WebSocket protocol.
byte[] CreateTextFrame(string text)
Parameters
text
stringThe text of the message.
Returns
- byte[]
A byte array containing the message frame.
ProcessData(IEnumerable<byte>)
Processes data received by the connection.
void ProcessData(IEnumerable<byte> data)
Parameters
data
IEnumerable<byte>The data to be processed.
Events
BinaryMessageHandled
Event raised when a binary message is processed by the handler.
event EventHandler<BinaryMessageHandledEventArgs> BinaryMessageHandled
Event Type
CloseHandled
Event raised when a close message is processed by the handler.
event EventHandler CloseHandled
Event Type
TextMessageHandled
Event raised when a text message is processed by the handler.
event EventHandler<TextMessageHandledEventArgs> TextMessageHandled