Commit 7816489
fix(F1): add OnConnect/OnDisconnect callbacks to fire ws_connect/ws_disconnect pipelines
The WebSocket hub's register channel fires when a new connection is added, but
the wsTrigger only listened for inbound messages. Add global connect/disconnect
handler hooks (same pattern as the existing message handler) so the trigger can
call TriggerCallback("connect", ...) and TriggerCallback("disconnect", ...).
- trigger_websocket.go: globalWSConnectHandler + globalWSDisconnectHandler vars,
set/call helpers, wsTrigger.Start wires both; Stop clears all three handlers.
- module_ws_server.go: fire callGlobalWSConnectHandler in a goroutine after
hub.register so the welcome message can be sent immediately on connect.
- connection.go: fire callGlobalWSDisconnectHandler from readPump defer so the
ws_disconnect pipeline triggers when the client's read loop exits.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent d7f1a42 commit 7816489
3 files changed
Lines changed: 73 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| |||
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
37 | 79 | | |
38 | 80 | | |
39 | 81 | | |
| |||
46 | 88 | | |
47 | 89 | | |
48 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
49 | 97 | | |
50 | 98 | | |
51 | 99 | | |
| |||
97 | 145 | | |
98 | 146 | | |
99 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
100 | 167 | | |
101 | 168 | | |
102 | 169 | | |
103 | 170 | | |
104 | 171 | | |
| 172 | + | |
| 173 | + | |
105 | 174 | | |
106 | 175 | | |
0 commit comments