Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CURL.WebSocketSend
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 |
Parameters
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 |
Result
Returns number or error.
Description
Send the specific message fragment over an established WebSocket connection.The text parameter holds the data to send.
Returns the number of payload bytes actually sent.
To send a (huge) fragment using multiple calls with partial content per invoke, set the offset flag (32) in the flags and the FrameSize argument as the total expected size for the first part, then set the offset flag (32) with a zero FrameSize for the following parts.
If not sending a partial fragment or if this is raw mode, FrameSize should be set to zero.
If kWebSocketRaw is enabled in WebSocketOptions, the flags argument should be set to 0.
Examples
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) ]
See also
- CURL.GetDebugMessages
- CURL.GetResultAsText
- CURL.New
- CURL.Perform
- CURL.Release
- CURL.SetOptionConnectionTimeout
- CURL.SetOptionConnectOnly
- CURL.SetOptionURL
- CURL.SetOptionWebSocketOptions
- CURL.WebSocketReceive
Release notes
- Version 13.0
- Added CURL.SetOptionWebSocketOptions, CURL.WebSocketReceive and CURL.WebSocketSend functions.
Blog Entries
- New in MBS FileMaker Plugin 13.0
- Neues MBS Plugin 13.0 für Claris FileMaker
- MBS Plugin 13.0 for Claris FileMaker
- MBS FileMaker Plugin, version 12.6pr3
This function checks for a license.
Created 11st December 2022, last changed 3th January 2023