Commit 263c690
committed
fix: correct push protocol and WebSocket message handling
- Enable WebSocket compression (permessage-deflate) to match server
- Add `extension` field to push metadata (required by server)
- Fix push protocol: read metadata response before sending chunks,
read per-chunk acks, handle "ok"/"next" server responses
- Drain pending push notifications before pushing in push command
- Handle server error field `err` in addition to `error`
- Add channel-based message dispatcher (readLoop) to safely multiplex
push notifications, responses, and binary frames across goroutines
Previously pushes silently failed: the server rejected them but errors
were swallowed due to missing error field mapping and wrong message
ordering. The WebSocket connection also dropped every ~20s due to
unhandled compression frames.1 parent 0ba53e5 commit 263c690
4 files changed
Lines changed: 225 additions & 91 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
168 | 179 | | |
169 | 180 | | |
170 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| |||
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
107 | 115 | | |
108 | 116 | | |
109 | 117 | | |
| |||
0 commit comments