Obtain data to send to the network. Call this method immediately after any of the ``receive_*()``, ``send_*()``, or :meth:`fail` methods. Write resulting data to the connection. The empty bytestring :data:`~websockets.protocol.SEND_EOF` signals the
(self)
| 495 | # Public method for getting outgoing data after receiving data or sending events. |
| 496 | |
| 497 | def data_to_send(self) -> list[bytes]: |
| 498 | """ |
| 499 | Obtain data to send to the network. |
| 500 | |
| 501 | Call this method immediately after any of the ``receive_*()``, |
| 502 | ``send_*()``, or :meth:`fail` methods. |
| 503 | |
| 504 | Write resulting data to the connection. |
| 505 | |
| 506 | The empty bytestring :data:`~websockets.protocol.SEND_EOF` signals |
| 507 | the end of the data stream. When you receive it, half-close the TCP |
| 508 | connection. |
| 509 | |
| 510 | Returns: |
| 511 | Data to write to the connection. |
| 512 | |
| 513 | """ |
| 514 | writes, self.writes = self.writes, [] |
| 515 | return writes |
| 516 | |
| 517 | def close_expected(self) -> bool: |
| 518 | """ |
no outgoing calls