Back to product page

WebSocketConnect event

Fires when request for WebSocket connection arrives.


  • Basic
Private Sub object_WebSocketConnect (ByRef User, ByRef Action)
The WebSocketConnect(object,User,Action) syntax has these parts:
objectAn expression evaluating to an object of type wodWebServer
UserWebUser object. Reference to the user who sent the request.
ActionWebActions enumeration. You should set this value to Allow user to create websocket.


This event is fired 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 event.