Commit Graph

419 Commits

Author SHA1 Message Date
Greg Heartsfield
1589268eba fix: use database to publish all events
This fixes a race condition where a publisher might send an event, and
immediately after issue a subscription for the same event ID.  Prior
to this change, that event would have been published on the broadcast
channel (and ignored by our publisher, because they had not yet issued
the subscription), but not yet committed to the database.  Their
subscription would trigger a database query which would return zero
results.  Therefore, they would never see the event they published.
The noscl tool is one client that would suffer from this.

Now, all events are broadcast only after they exist in the database,
so a late subscription will always return the event.
2021-12-12 10:20:23 -06:00
Greg Heartsfield
56c40f2be9 refactor: improve error messages 2021-12-12 10:03:28 -06:00
Greg Heartsfield
cacd1ccb36 docs: sample program output in README 2021-12-11 22:21:31 -06:00
Greg Heartsfield
ee8862be81 docs: README gives quickstart for docker 2021-12-11 22:19:49 -06:00
Greg Heartsfield
108938f709 feat: add data directory to Dockerfile 2021-12-11 22:18:05 -06:00
Greg Heartsfield
e732f918f9 refactor: clippy suggestions 2021-12-11 21:56:52 -06:00
Greg Heartsfield
ca0f01c94b docs: add rustdoc comments 2021-12-11 21:43:41 -06:00
Greg Heartsfield
04850506a8 build: upgrade dependencies 2021-12-11 16:58:18 -06:00
Greg Heartsfield
d79e0a59f5 config: change default websocket port 2021-12-11 16:57:55 -06:00
Greg Heartsfield
ee9efab2f7 feat: add Dockerfile 2021-12-11 16:46:42 -06:00
Greg Heartsfield
f91b1205ef docs: add README 2021-12-11 15:58:45 -06:00
Greg Heartsfield
65f62dc4ec docs: add MIT license 2021-12-11 15:52:25 -06:00
Greg Heartsfield
65969a4121 feat: store events in SQLite and allow querying
Events are persisted in a local database, and can be queried through
subscriptions.
2021-12-11 15:48:59 -06:00
Greg Heartsfield
23f47899cd feat: broadcast events that match active client subscriptions
A broadcast channel sends messages to all connections.  Any connection
with a subscription that matches then sends it via websocket.
2021-12-05 20:28:02 -06:00
Greg Heartsfield
8b4c43ae71 feat: add and remove subscriptions from client requests
A hashmap of active subscriptions is maintained for each client.  REQ
and CLOSE commands will modify the subscription list.
2021-12-05 18:14:14 -06:00
Greg Heartsfield
35ceb7cb64 feat: parse subscription close requests from websockets 2021-12-05 17:33:40 -06:00
Greg Heartsfield
e7d0ab1aca feat: parse subscriptions from websockets
Parses subscription requests (REQ, but not CLOSE).  Performs no
subscription state management yet.
2021-12-05 17:15:50 -06:00
Greg Heartsfield
92e9a5e639 feat: parse and validate events from websockets
Establishes a websocket listener, parses events, and performs
validation to ensure valid signatures.
2021-12-05 16:53:26 -06:00
Greg Heartsfield
d0c2b242cd feat: cargo build files and expected dependencies 2021-12-05 08:42:28 -06:00