-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support merging #43
Support merging #43
Conversation
This overlay for Usage: const rec = new ReceiverMerge({
universes: [1],
reuseAddr: true,
timeout: 5000, // time the values will be stored before they are droped (assuming the source is down / has stopped sending data)
// ... more options (everything here will be passed to new Receiver({...}))
})
rec.on("changed", ({ addr, newValue: value }) => { console.log(addr, value) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks! I'll have some time next week to properly test it.
add sender connect event Co-authored-by: Kyℓe Hensel <[email protected]>
clean up constructor Co-authored-by: Kyℓe Hensel <[email protected]>
add default value 0
- more detailed senderConnect - more detailed senderDisconnect - convert ServersData to interface
I have coded more detailed event objects; now they contain the senders cid and universe APImerger.on("senderConnect", (ev: {cid: string, universe: number, firstPacket: Packet}) => {
...
});
merger.on("senderDisconnect", (ev: {cid: string, universe: number, lastPacket: Packet}) => {
...
}); additionally I've added default values to comply with ts-strict and converted SendersData to |
- converted from string to [cid, universe] - renamed from pid to sid (sender-id)
There are two known bugs in the current version: The first one affects the sender-id storage (This is already 90% fixed; has something to do with the key equality in a JS Map) The other one appears if multiple universes are merged. In some circumstances the second universe is not merged. I am working on a project, where up to 4 sources send to different universes on multiple priorities, so I can test the merging functionality carefully. EDIT: they are all fixed by 2343cc6 |
- fix multiple universes bug (add universe equality constraint in merge core) - fix sender-id bugs (identify senders by a string instead of a [string,number] - add .on() typescript call signatures - add .clearCache() - add .on("changesDone") - fix spelling 'senderDis*C*onnect
- improved multi-universe management - improved timeout management - improved sender/universe storage
Thanks again for making this PR. My original concerns from #43 (comment) still apply, but firstly: the performance of nodejs v21's EventEmitter is much better than node v13, and secondly: I'd rather merge this PR than have it sit around for any longer. |
cherypick changes from #43 into this branch
fixes #2