Commit 84859e1
Add text argument to broadcast() to force the frame type
Closes #1694.
broadcast() now accepts a keyword-only text argument that mirrors
Connection.send(): set text=True to send a bytestring in a Text frame, or
text=False to send a str in a Binary frame. This lets callers control the
frame type without converting the message first, for example broadcasting
an already UTF-8 encoded payload as a text frame.
Based on the proposal and patch by @lampeh in #1694.1 parent 1a38f5a commit 84859e1
3 files changed
Lines changed: 31 additions & 2 deletions
File tree
- docs/project
- src/websockets/asyncio
- tests/asyncio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1148 | 1148 | | |
1149 | 1149 | | |
1150 | 1150 | | |
| 1151 | + | |
| 1152 | + | |
1151 | 1153 | | |
1152 | 1154 | | |
1153 | 1155 | | |
| |||
1159 | 1161 | | |
1160 | 1162 | | |
1161 | 1163 | | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1162 | 1175 | | |
1163 | 1176 | | |
1164 | 1177 | | |
| |||
1189 | 1202 | | |
1190 | 1203 | | |
1191 | 1204 | | |
| 1205 | + | |
| 1206 | + | |
1192 | 1207 | | |
1193 | 1208 | | |
1194 | 1209 | | |
1195 | 1210 | | |
1196 | 1211 | | |
1197 | 1212 | | |
1198 | | - | |
| 1213 | + | |
1199 | 1214 | | |
1200 | 1215 | | |
1201 | | - | |
| 1216 | + | |
1202 | 1217 | | |
1203 | 1218 | | |
1204 | 1219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1336 | 1336 | | |
1337 | 1337 | | |
1338 | 1338 | | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
1339 | 1349 | | |
1340 | 1350 | | |
1341 | 1351 | | |
| |||
0 commit comments