WIP: Run multiple mesh nodes on a single device #240
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.
So I decided to do a little experiment the last couple of nights and it ended up working pretty good, but before I spend more time on this I want to check if it's something that the community is interested in.
So this PR is a proof of concept that allows us to run multiple nodes on a single device. This allows us to do the following things for example:
At a very high level this is what's happening here:
MeshNode
.MeshNode
has its own unique identity.Mesh
itself, we will have specific implementations ofMeshNode
for server room, repeater, companion, etc. (provided here is an example for theRoomNode
).Mesh
keeps a reference to an array of nodes, and when a packet is received, it gets forwarded to the various nodes, which will determine if it's meant for them or not, and will either process it or ignore it.So using this architecture, I was able to modify the room server example so that 3 room servers are run on the same hardware, and it actually works, I was able to chat on each instance sharing messages with two clients.
Anyway, this is a proof of concept and is in not anywhere ready to be merged, but I wanted to gauge interest before I sink more time into it.