CURL.SetMQTTScript
------------------

Sets script to run when we receive a MQTT message,.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [14.3](newinversion143.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetMQTTScript"; curl; FileName; ScriptName ) 

**MBS**( **"CURL.SetMQTTScript";** /\* Sets script to run when we receive a MQTT message,. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$FileName**; /\* The database file name where the script is located.e.g. "test.fmp12" \*/   
**$ScriptName**) /\* The script name.e.g. "MyScript" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| FileName | The database file name where the script is located. | "test.fmp12" |
| ScriptName | The script name. | "MyScript" |

### Result

Returns OK or error.

### Description

Sets script to run when we receive a MQTT message,.  
### Examples

Setup MQTT:

 # Create CURL handle   
Set Variable \[ $curl ; Value: MBS ( "[CURL.New](CURLNew.md)" ) \]  
  
\# Set MQTT broker URL   
Set Variable \[ $r ; Value: MBS ( "[CURL.SetOptionURL](CURLSetOptionURL.md)" ; $curl ; "mqtt://broker.hivemq.com:1883" ) \]  
  
\# Assign FileMaker script to receive MQTT events   
\# "MQTT\_Callback" is the FileMaker script that will be triggered   
Set Variable \[ $r ; Value: MBS ( "CURL.SetMQTTScript" ; $curl ; "MQTT\_Callback" ) \]  
### See also

- [CURL.GetMQTTScriptName](CURLGetMQTTScriptName.md)
- [CURL.New](CURLNew.md)
- [CURL.SetOptionURL](CURLSetOptionURL.md)

### Release notes

- **Version 14.3**
    - Added [CURL.SetMQTTScript](https://www.mbsplugins.eu/CURLSetMQTTScript.shtml), [CURL.GetMQTTFileName](https://www.mbsplugins.eu/CURLGetMQTTFileName.shtml) and [CURL.GetMQTTScriptName](https://www.mbsplugins.eu/CURLGetMQTTScriptName.shtml) functions.

### Example Databases

- [CURL/MQTT](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/MQTT.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin 14.3 News](https://www.mbsplugins.de/archive/2024-07-17/MBS_FileMaker_Plugin_143_News/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 14.3 für Claris FileMaker](https://www.mbsplugins.de/archive/2024-07-09/Neues_MBS_Plugin_143_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 14.3 for Claris FileMaker](https://www.mbsplugins.de/archive/2024-07-09/MBS_FileMaker_Plugin_143_for_C/monkeybreadsoftware_blog_filemaker)
- [MQTT in FileMaker](https://www.mbsplugins.de/archive/2024-06-25/MQTT_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 14.3pr2](https://www.mbsplugins.de/archive/2024-06-10/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 6th June 2024 , last changed 22nd February 2026

  
[CURL.SetInputText](CURLSetInputText.md) - [CURL.SetMultiOptionChunkLengthPenaltySize](CURLSetMultiOptionChunkLengthPenaltySize.md)

[HTML Version](CURLSetMQTTScript.shtml)