Send a `Continuation frame`_. .. _Continuation frame: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6 Parameters: data: payload containing the same kind of data as the initial frame. fin: FIN bit; set it to :obj
(self, data: BytesLike, fin: bool)
| 292 | # Public methods for sending events. |
| 293 | |
| 294 | def send_continuation(self, data: BytesLike, fin: bool) -> None: |
| 295 | """ |
| 296 | Send a `Continuation frame`_. |
| 297 | |
| 298 | .. _Continuation frame: |
| 299 | https://datatracker.ietf.org/doc/html/rfc6455#section-5.6 |
| 300 | |
| 301 | Parameters: |
| 302 | data: payload containing the same kind of data |
| 303 | as the initial frame. |
| 304 | fin: FIN bit; set it to :obj:`True` if this is the last frame |
| 305 | of a fragmented message and to :obj:`False` otherwise. |
| 306 | |
| 307 | Raises: |
| 308 | ProtocolError: If a fragmented message isn't in progress. |
| 309 | |
| 310 | """ |
| 311 | if not self.expect_continuation_frame: |
| 312 | raise ProtocolError("unexpected continuation frame") |
| 313 | if self._state is not OPEN: |
| 314 | raise InvalidState(f"connection is {self.state.name.lower()}") |
| 315 | self.expect_continuation_frame = not fin |
| 316 | self.send_frame(Frame(OP_CONT, data, fin)) |
| 317 | |
| 318 | def send_text(self, data: BytesLike, fin: bool = True) -> None: |
| 319 | """ |