comparison .claude/skills/zenbu-seobeo-networking/SKILL.md @ 257:609d3c6aff4e

[seobeo] Add persistent SSE streams Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Tue, 04 Aug 2026 16:49:11 -0700
parents 745fd127b2a1
children
comparison
equal deleted inserted replaced
256:30c2196d03d4 257:609d3c6aff4e
62 ```c 62 ```c
63 Seobeo_WebSocket_Server_Init(); 63 Seobeo_WebSocket_Server_Init();
64 Seobeo_WebSocket_Server_Register("/chat", Chat_Handler, NULL); 64 Seobeo_WebSocket_Server_Register("/chat", Chat_Handler, NULL);
65 ``` 65 ```
66 66
67 Server-Sent Events:
68
69 ```c
70 void Events(
71 Seobeo_SSE_Stream *p_stream,
72 Seobeo_Request_Entry *p_request,
73 Dowa_Arena *p_arena)
74 {
75 Seobeo_SSE_Send_Data(p_stream, "ready");
76 }
77
78 Seobeo_Router_Register_SSE("/events", Events);
79 ```
80
81 SSE handlers run once during connection setup and must return promptly. The
82 stream may be retained for later thread-safe sends only through balanced
83 `Seobeo_SSE_Retain` / `Seobeo_SSE_Release` calls; request/response arenas and
84 request-map pointers expire when the handler returns. Check
85 `Seobeo_SSE_Is_Open`, handle bounded backpressure, and use comments for
86 heartbeats.
87
67 Background work: 88 Background work:
68 89
69 ```c 90 ```c
70 Seobeo_Worker_Pool *pool = Seobeo_Worker_Pool_Create(2, 16); 91 Seobeo_Worker_Pool *pool = Seobeo_Worker_Pool_Create(2, 16);
71 Seobeo_Worker_Pool_Submit(pool, Process_File, context, free); 92 Seobeo_Worker_Pool_Submit(pool, Process_File, context, free);
96 117
97 ```bash 118 ```bash
98 bazel test //seobeo:seobeo_client_test 119 bazel test //seobeo:seobeo_client_test
99 bazel test //seobeo:seobeo_websocket_test 120 bazel test //seobeo:seobeo_websocket_test
100 bazel test //seobeo:seobeo_websocket_server_test 121 bazel test //seobeo:seobeo_websocket_server_test
122 bazel test //seobeo/tests:seobeo_sse_test
101 ``` 123 ```
102 124
103 For API changes, also build downstream users: 125 For API changes, also build downstream users:
104 126
105 ```bash 127 ```bash