Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract protocol serialization/deserialization and expose it #420

Open
mprudnik opened this issue Jun 20, 2023 · 0 comments
Open

Extract protocol serialization/deserialization and expose it #420

mprudnik opened this issue Jun 20, 2023 · 0 comments

Comments

@mprudnik
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant