Skip to content

Extract protocol serialization/deserialization and expose it #420

@mprudnik

Description

@mprudnik

Is your feature request related to a problem? Please describe.

Metacom packet structure would come in handy everywhere where there is a need to build communication over messages:
For example:

  • bus using redis streams
  • communication with workers using postMessage
    and basically anywhere where you have only messages and want to build RPCs, events, or streams over it.

Describe the solution you'd like

Extract protocol code to lib/protocol.js, export it from metacom.
Example implementation:
mprudnik@c2c6cc1
It also can be reused in metacom itself:
mprudnik@c08692e

Additional context

As a side effect, it can simplify and make metacom code more readable and maintainable - protocol code is in one place, no need to check Contracts.md and it can be covered with tests (as in the first example).
It also simplifies integration with systems where you can't use metacom as a package. For example, using k6 for API load testing you can write scripts in JS, but it's not a node env and there's no module resolution like in node. Having metacom protocol serialization/deserialization in one file you can copy/past it and integrate the rest with what is exposed by k6 and use to load test metarhia applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions