Skip to content

Send messages from Elixir to Tortoise.Connection #131

Description

@m1dnight

Hi all,

I'm writing a system where I would like to process events coming from an MQTT server, through the Tortoise connection, into my regular Elixir code. From my regular Elixir code I would like to send commands back to the MQTT server.

So this would look something like this:

+----+     +--------+     +------+
|mqtt|<--->|tortoise|<--->|elixir|
+--+-+     +--------+     +------+

However, I notice that it doesn't seem possible to send messages from the application to the Tortoise connection handler.
I do know that you can manually send events directly to the connection using Tortoise.publish/3, but that, i think, splits the code concerned with MQTT communication in two. It would be nicer if all that logic would be contained within a single module.

Currently the diagram looks more like this:

+----+          +--------+           +------+
|mqtt|<-------->|tortoise|---------->|elixir|
+--+-+          +--------+           +-+----+
   ^                                   |
   +-----------------------------------+

So perhaps adding support for handle_info/2 or something would be useful?

This is all under the assumption that I understand what I'm doing. I might as well be missing something?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions