creating a listener thread in mod (mqtt integration)

Discussion in 'Empyrion API' started by imlarry425, Feb 24, 2023.

  1. imlarry425

    imlarry425 Captain

    Joined:
    Jan 10, 2019
    Messages:
    460
    Likes Received:
    338
    My C# is pretty darn remedial and teaching yourself OO system programming with google is a slog... :)

    For those of you that do such things, how would one create a thread that acts as a listener for the life of the mod instance? I want to instantiate something/somehow in the Init that lives beyond the Init's exit ... a detached listener thread that opens a channel and declares a handler to process messages, and then goes to sleep and persists the client connection and any properties it needs after the init is finished.

    The underlying thing getting called is MQTT- a light-weight protocol for a subscriber/publisher model that was built for intermittent and high latency connections. Publishing was pretty easy (three-line client side gameEvent tracer!) but not sure on best practice for setting up a subscriber/listener.

    [​IMG]
     
    #1
  2. imlarry425

    imlarry425 Captain

    Joined:
    Jan 10, 2019
    Messages:
    460
    Likes Received:
    338
    Problem fixed .. thanks ChatGPT. Bidirectional queued messaging achievement unlocked.
     
    #2

Share This Page