Back to product page

WebSocketData callback method


Called when data arrives on WebSocket.

Syntax

  • Basic
object.WebSocketData (Owner, User, IsText, PartSize, FrameSize)
The WebSocketData(object,User,IsText,PartSize,FrameSize) syntax has these parts:
objectAn expression evaluating to an object of type IwodWebNotify
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!

Remarks

NOTE: This method is called only if you implemented IwodWebNotify interface in your application, and wodWeb1.Notification property has received reference to instance of your implementation.

This notification method is called when user wants to upgrade regular HTTP connection to websocket, so it can perform full-duplex communication with the server. You can decide to Accept or Deny the connection. By default, all websocket requests will be denied.

Before accepting you should perform "security" check if you want to trust incoming connection, since it may basically send you any kind of information for which you should decide to accept it or not. Typically, you should check Request Headers to see if they match for what you expect them to be.
You can also use URI to differentiate different websocket requests - based on how you plan to handle them in the code.

Once connection is accepted, when data starts arriving you will get notified using WebSocketData notification method.

Platforms

Windows