How to integrate MQTT into a script

Forum Home Forums Understanding the Software How to integrate MQTT into a script

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17808
    38368423
    Participant

    I 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.cs

    #17809
    Mikhail
    Moderator

    Hello,

    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

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.