Back to product page

WebSocketDataEvent event


Fires when data arrives on WebSocket.

Syntax

  • C
  • VB.NET
delegate void WebSocketDataDelegate(object Sender, WebSocketDataArgs Args);
The WebSocketDataEvent(Args.FrameSize,Args.PartSize,Args.IsText,Args.User) syntax has these parts:
Args.FrameSizeInteger value. Size of full frame (that was possibly chunked) that user wanted to send. Usually denotes full message sent from the client. This value may be empty!
Args.PartSizeInteger value. Size of current 'chunk' of data arrived from the user.
Args.IsTextBoolean value. Set to True is data is declared as text.
Args.UserWebUser object. Reference to the user who is connected to the server.

Delegate Sub WebSocketDataDelegate(ByVal Sender as Object, ByVal Args As WebSocketDataArgs)
The WebSocketDataEvent(Args.FrameSize,Args.PartSize,Args.IsText,Args.User) syntax has these parts:
Args.FrameSizeInteger value. Size of full frame (that was possibly chunked) that user wanted to send. Usually denotes full message sent from the client. This value may be empty!
Args.PartSizeInteger value. Size of current 'chunk' of data arrived from the user.
Args.IsTextBoolean value. Set to True is data is declared as text.
Args.UserWebUser object. Reference to the user who is connected to the server.

Remarks

After you have accepted websocket connection, client may start to send you data. As data arrives, this event fires. Data may be fragmented, and this event is fired for each fragment. PartSize argument will always have size of current fragment. If there are more parts or chunks expected to arrive, FrameSize will be 0.

When full data arrives that form a Frame, FrameSize argument will contain size of full fragment.

You should use WebSocketReceiveText method to read incoming data anytime you wish, inside or outside of this event.

Platforms

Windows