Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
P2P connectivity
Libp2p offers great capability of out-of-the-box, P2P networking for any environment. This will allow better implementation and less point of failures, with minimal centralization: no more bottlenecks like PubSub and networking, whether it is Kubernetes or your localhost, it just works.
Tasks
Demo
With Docker, you can spin up three Soketi instances that are able to discover each other over the network with mDNS.
With a WS client, you got now
6001
,6002
and6003
as open ports for Soketi.The WS URL format is the following:
Using your WS client (i.e.
ws-cat
), connect to at least two:Messages are now transported via the P2P Protocol:
Publishing different packages using Aegir
Since there will be multiple implementations for the same structure, different packages will make them more maintenable. Meet Aegir. Aegir will help with publishing multiple packages at the same time.
Development
@soketi/impl
This package contains the very base of components needed to build the servers (explained below).
Brain
Brain is the codename for the memory storage. It resembles some simple Redis-like KV (put, get, evictions, etc.) for easy implementation of multiple providers.
Gossiper
Gossipers are instances that help with cross-host comms. Since we leverage just Libp2p (for now), the Gossiper is an overlay for the underlying PubSub.
Gossipers are not meant to be discovering other instances necessarily. For better encapsulation, the Prospector is the one that has this mere task.
Gossipers are not for the request-response architecture, instead they are for the send-and-forget messaging, like PUBLISH on Redis or Kafka. For req-res, Prospectors do that. (We plan to break it down even further with an Ambassator component that will communicate with other instances, but it's too much for now)
Prospector
Prospector is a codename for the discoverer of other instances. In a normal Redis setup, you would find the number of subscribed instances. Here, the Prospector ensures direct communication between hosts (i.e. getting the total amount of connections across a specific namespace by ensuring to call only the nodes that have connections in that namespace).
This might be replaced by a distributed, libp2p-protocol based database, but more research is needed.
Prospector is still work in progress.
@soketi/impl-interfaces
This contains the types and interfaces for Typescript.
@soketi/servers
WIP