MQTT for Android chat applications / Limiting topic access -
i'm trying create chat application android using mqtt, there limited information on how that.
so far i've set mqtt broker user can listen , publish topics (surely that's not 1 wants in chat applications).
i'm using mosquitto broker , it's listing set of features in it's documentation:
topic access added lines of format:
topic [read|write|readwrite] <topic>
it possible define acls based on pattern substitution within topic. form same topic keyword, using pattern keyword.
pattern [read|write|readwrite] <topic>
the patterns available substition are:
%c match client id of client %u match username of client
the substitution pattern must text level of hierarchy. pattern acls apply users if "user" keyword has been given.
example:
pattern write sensor/%u/data
allow access bridge connection messages:
pattern write $sys/broker/connection/%c/state
so far thought of doing like: pattern readwrite chat/%u/msg
but limits each user read/write on own topic, , that's not intended behavior.
so question is:
is there way set on-the-fly permissions topics?
how 1 ensure eg in chat between a-b-c there topic a-b-c only a-b-c can read , write on?
not using acl file, mosquitto supports plugin system acls
e.g. https://github.com/jpmens/mosquitto-auth-plug/
this allows store acls in database can updated on fly
Comments
Post a Comment