-
Notifications
You must be signed in to change notification settings - Fork 25
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
Batching notifications for multiple domains #15
Comments
OK, notifications have an id and a type. But they also need a value--which is what gets put in the client cell. |
Initial draft will be here: https://github.com/laforge49/simple-notifications |
Draft of server-side is working. |
Initial draft is working. |
Oh, still a bit to do on the client side. |
Clients now sort and filter incoming notifications. Client side is (again!) finished. |
I went through the code and changed the names to be more descriptive. |
After discussion with Micha, I'll be breaking out the notification logic into separate source files. |
The code is looking much better now, thanks to Micha. The library code is now in separate source files. And doc strings have been added. Next step is to put this in a hoplon project. |
OK, Micha, I've done what I can in the new hoplon/notify project. So it is over to you again. |
Thanks Micha! I'll work on testing this now. |
How do we move server notifications to a web client?
Hoplon/castra is like the good old days all over again, except that there may be multiple polling loops as there may be multiple domains. Ouch! Lets develop an API for castra (or that can sit on top of websockets) that passes server notifications to a hoplon client's input cells. Later we can embellish the implementation of the API to support alternative transports.
First, we can register input cells as receiving a type of notification, where each type of notification is identified by a keyword. Of course, we might be able to get fancy and have the mapping handled without the need for registration.
Second, the notifications. These would be a map with an id and a type. The value of the id is a consecutively increasing number specific to each client; the id being used to determine which haplon input cell to update.
Third, we would also have an ack-number. When a server gets an ack-number, it will no longer send any notification with an id less than or equal to that ack-number. Poll requests sent to a server always contain an ack-number and are requests for all notifications with an id greater than the ack-number. On receipt of a poll request, the server drops all notifications that have been acknowledged and sends in a vector all the unacknowledged notifications.
Now when a server has a notification for a client, it assigns it the next notification id for that client and puts it in a sorted map with all the other pending notifications, keyed by that id, where each client has its own sorted map.
The API is pretty simple. A means of mapping notification types to cells on the client and a means of adding notifications to the pending notifications map for a client. We will also likely need a way to control the poll loop as well.
The text was updated successfully, but these errors were encountered: