ratatoskr-mm

Ratatoskr — MQTT client-local routing and upstream-subscriptions merger - the things you expected to be there, and nothing more

Usage no npm install needed!

<script type="module">
  import ratatoskrMm from 'https://cdn.skypack.dev/ratatoskr-mm';
</script>

README

Ratatoskr MM

It was called simply Ratatoskr while using inhouse, now that we've extracted code for a WiP of open source, we realized there was another ratatoskr. So "Ratatoskr MQTT Managment", or whatever you'd like to call it.

MAJOR WARNING

This OSS-extraction is WiP - as long as you read this line - it's not ready for consumption. Expect a week or so more at least.

Objectives

  • Aims to do as little as possible, only what "one would expect", and just a tiny tiny tad more
  • Routes messages to topics within you application
  • Does parameter extraction
    • We've switched the route-string-syntax to Express-router syntax for familiarity
  • Variable expansion
    • %c, %u is replaced with cliend_id and username, respectively, whether in publish or subscribe
  • Upstream subscription topic reduction
    • Important - without this functionality you will receive multiple duplicates of messages as soon as you subscribe to moderately mixed topics with different wildcards
  • Additions that "aren't necessary"
    • You're allowed to use * instead of +, and ** instead of #
    • You're allowed to use ** in the middle of topic-patterns: MQTT doesn't support duch patterns, so upstream the topic will be as wide as where the **/# comes into play
    • You can subscribe to "only messages that haven't been handled" - this will not generate subscribes upstream, only catch incoming messages after the regular queue when no handler has matcher or accepted them
    • There's a rcv function that subscribes for exactly on message. The unsubscription is handled in the router to ensure this contract.
  • Relies on Promises (async code style)
  • There is also a Kotlin-version that we use in Android - will be open sourced shortly