Back to product page

WebSocketData event

Fires when data arrives on WebSocket.


  • Basic
Private Sub object_WebSocketData (ByRef User, IsText, PartSize, FrameSize)
The WebSocketData(object,User,IsText,PartSize,FrameSize) syntax has these parts:
objectAn expression evaluating to an object of type wodWebServer
UserWebUser object. Reference to the user who sent the request.
IsTextBoolean value. Set to True is data is declared as text.
PartSizeLong value. Size of current 'chunk' of data arrived from the user.
FrameSizeLong 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!


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.