This repository was archived by the owner on Jun 1, 2026. It is now read-only.
Commit f44a12d
committed
Refactor websockets; add device stream events
Introduce a unified websocket helper and refactor websocket handling, plus add device stream event support across services.
Key changes:
- New apps/api/src/websocket.rs: common Redis setup (setup_ws_resources) and PushInfo decoding (decode_push_message).
- Refactor websocket_prices and websocket_stream: remove duplicated Redis setup, improve message handling, move configs out of Mutex where safe, better logging/error handling, and simplify stream loops.
- Split price handling into a dedicated PriceHandler for websocket_stream to encapsulate asset tracking, subscription logic, and payload building.
- Improve apps/api/src/main.rs: better CLI service parsing with strum iteration and unified Rocket launch path.
- Add device stream feature: DeviceStreamPayload/DeviceStreamEvent types (crates/streamer), queue name and producer API for DeviceStreamEvents, daemon consumer DeviceStreamConsumer to publish device-scoped stream events to cacher.
- Add CacherClient::publish helper to publish JSON messages to Redis channels.
- Various small API/serialization and testkit cleanups.
Why: removes duplication, isolates responsibilities (price handling, Redis setup), adds support for pushing device-targeted stream events, and improves robustness and logging for websocket components.1 parent b96f865 commit f44a12d
19 files changed
Lines changed: 513 additions & 370 deletions
File tree
- apps
- api/src
- websocket_prices
- websocket_stream
- daemon/src/consumers/store
- crates
- cacher/src
- primitives/src
- testkit
- streamer/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
271 | | - | |
| 273 | + | |
272 | 274 | | |
273 | 275 | | |
274 | 276 | | |
| |||
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
295 | | - | |
| 297 | + | |
296 | 298 | | |
297 | 299 | | |
298 | 300 | | |
| |||
302 | 304 | | |
303 | 305 | | |
304 | 306 | | |
305 | | - | |
306 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
307 | 314 | | |
308 | 315 | | |
309 | 316 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
324 | 323 | | |
325 | 324 | | |
326 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | | - | |
21 | | - | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 42 | + | |
| 43 | + | |
50 | 44 | | |
51 | 45 | | |
52 | | - | |
53 | | - | |
| 46 | + | |
| 47 | + | |
54 | 48 | | |
55 | 49 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
63 | 54 | | |
64 | 55 | | |
65 | 56 | | |
66 | 57 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 58 | + | |
| 59 | + | |
80 | 60 | | |
81 | 61 | | |
82 | 62 | | |
83 | 63 | | |
84 | | - | |
| 64 | + | |
85 | 65 | | |
86 | 66 | | |
87 | 67 | | |
88 | 68 | | |
89 | 69 | | |
90 | 70 | | |
91 | 71 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 72 | + | |
96 | 73 | | |
97 | 74 | | |
98 | 75 | | |
99 | 76 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 77 | + | |
106 | 78 | | |
107 | 79 | | |
108 | 80 | | |
109 | | - | |
| 81 | + | |
110 | 82 | | |
| 83 | + | |
111 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
112 | 89 | | |
| 90 | + | |
113 | 91 | | |
114 | 92 | | |
115 | 93 | | |
| 94 | + | |
116 | 95 | | |
117 | | - | |
| 96 | + | |
118 | 97 | | |
119 | | - | |
120 | | - | |
| 98 | + | |
121 | 99 | | |
122 | | - | |
123 | | - | |
| 100 | + | |
| 101 | + | |
124 | 102 | | |
125 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
126 | 106 | | |
127 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
128 | 110 | | |
129 | 111 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
140 | 119 | | |
141 | 120 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | | - | |
| 17 | + | |
19 | 18 | | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
0 commit comments