Forum Home › Forums › Understanding the Software › How to integrate MQTT into a script
- This topic has 1 reply, 2 voices, and was last updated 36 minutes ago by
Mikhail.
-
AuthorPosts
-
April 1, 2026 at 2:59 am #17808
38368423
ParticipantI want to use MQTT in the automatic control module to send logs to a third-party system. Since the script is dynamically compiled, it will fail. How should I integrate it? The following is the error log.
2026-04-01 10:34:39 [EMS][EMS$][ERR] Error compiling the source code of the scripts and formulas:
(964,30): error CS0246: The type or namespace name ‘IMqttClient’ could not be found (are you missing a using directive or an assembly reference?)
(965,30): error CS0246: The type or namespace name ‘MqttClientOptions’ could not be found (are you missing a using directive or an assembly reference?)
(967,30): error CS0246: The type or namespace name ‘ConcurrentQueue<>’ could not be found (are you missing a using directive or an assembly reference?)
(968,30): error CS0246: The type or namespace name ‘Thread’ could not be found (are you missing a using directive or an assembly reference?)
(986,35): error CS0246: The type or namespace name ‘MqttFactory’ could not be found (are you missing a using directive or an assembly reference?)
(989,35): error CS0246: The type or namespace name ‘MqttClientOptionsBuilder’ could not be found (are you missing a using directive or an assembly reference?)
(1000,31): error CS0246: The type or namespace name ‘Thread’ could not be found (are you missing a using directive or an assembly reference?)
(1018,24): error CS0019: Operator ‘>’ cannot be applied to operands of type ‘method group’ and ‘int’
(1031,60): error CS0103: The name ‘CancellationToken’ does not exist in the current context
(1038,47): error CS0246: The type or namespace name ‘MqttApplicationMessageBuilder’ could not be found (are you missing a using directive or an assembly reference?)
(1041,60): error CS0103: The name ‘MQTTnet’ does not exist in the current context
(1044,59): error CS0103: The name ‘CancellationToken’ does not exist in the current context
(1053,21): error CS0103: The name ‘Thread’ does not exist in the current context
Check the source code in D:\SCADA\ScadaServer\Log\CalcEngine.csApril 1, 2026 at 11:41 am #17809
MikhailModeratorHello,
The Server scripting engine has no references to the MQTT classes.
What is the general idea of how the script should work?
I suggest this manual about Server scripts https://rapidscada.net/docs/en/latest/configuration/scripts -
AuthorPosts
- You must be logged in to reply to this topic.