grapewire
TypeScript icon, indicating that this package has built-in type declarations

0.8.8 • Public • Published

Grapewire

It was called "Ratatosk", then "Ratatoskr", in-house. Now that we've extracted code for a WiP of open source, we realized there was another ratatoskr. So changed to the name that of an old pub/sub-lib based on ZMQ that I never published: "Grapewire".

MAJOR WARNING

This OSS-extraction is WiP - as long as you read this line - it's not ready for consumption. Expect a few more weeks 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
    • The router can be used standalone without the sub-reduction management etc.
  • 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 wild cards
  • 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
  • Queues pubs and subs when disconnected. Sends pubs first.
  • Handles reconnecting
  • Currently utilizes mqtt.js as underlying transport
    • shouldn't be to hard to refactor to allow different implementations
  • Some 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 such patterns, so upstream the topic will be as wide as where the **/# first comes into play in the pattern
    • 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 - TODO specs must change here.
    • There's a rcv function that subscribes for exactly one 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
  • A Swift-version for iPhone is planned.

Package Sidebar

Install

npm i grapewire

Weekly Downloads

17

Version

0.8.8

License

ISC

Unpacked Size

211 kB

Total Files

35

Last publish

Collaborators

  • ozra