Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
13.5
Statistic
FMM
Blog
Send the specific message fragment over an established WebSocket connection.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 13.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
curl | The CURL session handle. | $curl | |
Text | The post data. | "" | |
Encoding | The text encoding for text parameter. Default is UTF-8. |
"UTF8" | Optional |
FrameSize | The frame size. Default is zero. |
0 | Optional |
SendFlags | The send flags. Default is zero. |
0 | Optional |
Returns number or error.
Test web socket:
# Start new session
Set Variable [ $curl ; Value: MBS("CURL.New") ]
# put in your web service test URL:
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; "ws://yourserver.com/echo“) ]
# connect only with short timeout
Set Variable [ $result ; Value: MBS("CURL.SetOptionConnectionTimeout"; $curl; 5) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionConnectOnly"; $curl; 2) ]
# Do connection setup
Set Variable [ $result ; Value: MBS("CURL.Perform"; $curl) ]
Set Field [ CURL Test::Result ; $result ]
# Check result
Set Field [ CURL Test::Text ; MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugMessages"; $curl) ]
If [ $result = "OK" ]
# send something
Set Variable [ $result ; Value: MBS("CURL.WebSocketSend"; $curl; "Hello World") ]
# receive answer
Set Field [ CURL Test::header ; MBS("CURL.WebSocketReceive"; $curl) ]
End If
# Cleanup
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]
This function checks for a license.
Created 11st December 2022, last changed 3th January 2023