Commit 69bfa29
authored
feat: convert websockets to server-side events (#1587)
* refactor: transition from WebSocket to Server-Sent Events (SSE) for real-time updates
- Updated documentation and codebase to replace WebSocket references with SSE, enhancing the real-time communication mechanism.
- Modified AGENTS.md, README, and various architecture documents to reflect the shift to SSE for Google Calendar sync and event notifications.
- Introduced a new feature document for Google Sync and SSE, detailing the architecture and event flow.
- Removed obsolete WebSocket code and dependencies from the backend, ensuring a cleaner and more maintainable codebase.
- Updated tests and hooks to utilize SSE, ensuring consistent behavior across the application.
* chore(deps): update dependencies in yarn.lock
- Updated "@adobe/css-tools" to version 4.4.4.
- Removed obsolete "socket.io" and "socket.io-client" dependencies.
- Updated "@emnapi/core" and "@emnapi/runtime" to version 1.9.1.
- Updated "@napi-rs/wasm-runtime" to version 1.1.2 with peer dependencies.
- Bumped "@opentelemetry/api" to version 1.9.1 and "@opentelemetry/core" to version 2.6.1.
- Updated "@posthog/core" to version 1.24.3 and "@posthog/types" to version 1.364.1.
- Updated "@sinclair/typebox" to version 0.34.49 and "@tanstack/react-store" to version 0.9.3.
- Updated "@tanstack/store" to version 0.9.3.
* feat(webpack): add alias for Server-Sent Events (SSE) module
- Introduced an alias for the SSE module in the webpack configuration, enhancing module resolution and improving code organization.
* fix(loaders): handle SuperTokens session checks in test environment
- Added a condition in the loadAuthenticated function to return an unauthenticated state when NODE_ENV is set to "test", preventing session checks from blocking navigation during Playwright e2e tests.
* refactor(sse): transition to EventEmitter for SSE event handling
- Replaced direct EventSource event listeners with an EventEmitter2 instance for improved event management.
- Updated hooks to utilize the new sseEmitter for handling SSE events, enhancing modularity and maintainability.
- Refactored tests to accommodate the changes in event handling, ensuring consistent behavior across the application.
* refactor(sse): update USER_METADATA publishing method and enhance test coverage
- Changed the USER_METADATA publishing method in the SSE server to use a response object, improving the handling of server-sent events.
- Added a test to ensure that USER_METADATA is not replayed to existing tabs when a new tab opens, enhancing the reliability of the SSE implementation.
* refactor(base.driver): streamline event handling in BaseDriver class
- Moved the initialization of eventName and dataLine variables outside the loop in the BaseDriver class, improving code clarity and reducing redundancy.
- Updated the test file for SSE server to remove redundant comments, enhancing readability while maintaining the test environment setup.
* fix(events): ensure proper response handling for SSE stream errors
- Added a check to send a 500 status response if an error occurs while opening the SSE stream and headers have not been sent, improving error handling in the EventsController.
- Removed obsolete socket alias from jest configuration, streamlining module resolution for the web project.
* refactor(sse): improve connection management in SSE server
- Updated the connection handling logic in the SSE server to utilize a dedicated method for removing dead connections, enhancing code clarity and maintainability.
- Refactored the subscription and error handling processes to ensure proper cleanup of connections, improving overall reliability of the SSE implementation.1 parent 982383f commit 69bfa29
77 files changed
Lines changed: 1430 additions & 2523 deletions
File tree
- docs
- architecture
- backend
- development
- features
- frontend
- packages
- backend
- src
- __tests__/drivers
- common/errors/handlers
- events
- controllers
- servers
- express
- ngrok
- sse
- websocket
- sync
- controllers
- services
- sync
- __tests__
- compass
- core/src
- constants
- types
- util
- web
- src
- auth
- google
- hooks/google/useConnectGoogle
- session
- common/apis
- ducks/events/context
- routers
- socket
- client
- hooks
- provider
- sse
- client
- hooks
- provider
- views
- Calendar/hooks
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | | - | |
| 486 | + | |
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
0 commit comments