WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Allows you to establish a non-secure connection (ws://) with a WebSocket server. Once the connection is established, the WebSocket can be handled like a standard socket, thus allowing you to use SocketRead, SocketWrite, SocketClose or SocketExist.
  • This function has two syntaxes. A synchronous (with a timeout and a return value) and an asynchronous connection syntax (with a callback procedure).
  • SocketChangeTransmissionMode will have no effect with a socket created with WebSocketClientConnect. The socket uses the SocketNoEndTag mode.
  • WebSocketClientConnectSSL is used to establish a secure SSL connection (wss://) with a WebSocket server.
// Connects to ws://
IF WebSocketClientConnect("wbsocket", "",80,"/WW_WebsocketServer") THEN
// Sends a message to the echo server
IF SocketWrite("wbsocket", "Hello world!") THEN
// Retrieves the server response
sMsg is string = SocketRead("wbsocket", True)
ToastDisplay("Server response: " + sMsg)

Establishing an asynchronous connection Hide the details

WebSocketClientConnect(<Socket name> , <WLanguage procedure> , <Server address> [, <Port> [, <Path> [, <Protocols>]]])
<Socket name>: Character string
Name that will be given to the connection opened on the socket. This name will be used by all socket functions.
<WLanguage procedure>: Procedure name
Name of the procedure called when the connection to the server is established. This procedure can be used to send a message to the server with SocketWrite, for example.
For more details on this procedure, see Parameters of the procedure used by WebSocketClientConnect.
CAUTION : the procedure is called in the application's main thread:
  • You can access UI controls from the procedure.
  • The process should not be too long, since this could block the user.
<Server address>: Character string
Server address. This address can be given in the following format:
  • IP address in XXX.XXX.XXX.XXX format ( for example).
  • URL containing the server name ( for example). This syntax is recommended.
AndroidAndroid Widget The address must be the server IP address (not the server name).
<Port>: Optional integer
Port number of the socket. By default, this parameter is 443 (HTTPS port).
<Path>: Optional character string
Path to the virtual directory of the server (if any). By default, or if this parameter is an empty string (""), the path corresponds to "/".
<Protocols>: Optional character string
List of protocols the server must support to establish the connection (for example : "mqtt,soap"). In this list, the different protocols are separated by a comma (","). A (non-exhaustive) list of protocols can be found here :
Business / UI classification: Business Logic
Component: wd280com.dll
Minimum version required
  • Version 27
This page is also available for…
Click [Add] to post a comment