| 809 | stream = None # type: IOStream |
| 810 | |
| 811 | def __init__( |
| 812 | self, |
| 813 | handler: "_WebSocketDelegate", |
| 814 | mask_outgoing: bool, |
| 815 | params: _WebSocketParams, |
| 816 | ) -> None: |
| 817 | WebSocketProtocol.__init__(self, handler) |
| 818 | self.mask_outgoing = mask_outgoing |
| 819 | self.params = params |
| 820 | self._final_frame = False |
| 821 | self._frame_opcode = None |
| 822 | self._masked_frame = None |
| 823 | self._frame_mask = None # type: Optional[bytes] |
| 824 | self._frame_length = None |
| 825 | self._fragmented_message_buffer = None # type: Optional[bytes] |
| 826 | self._fragmented_message_opcode = None |
| 827 | self._waiting = None # type: object |
| 828 | self._compression_options = params.compression_options |
| 829 | self._decompressor = None # type: Optional[_PerMessageDeflateDecompressor] |
| 830 | self._compressor = None # type: Optional[_PerMessageDeflateCompressor] |
| 831 | self._frame_compressed = None # type: Optional[bool] |
| 832 | # The total uncompressed size of all messages received or sent. |
| 833 | # Unicode messages are encoded to utf8. |
| 834 | # Only for testing; subject to change. |
| 835 | self._message_bytes_in = 0 |
| 836 | self._message_bytes_out = 0 |
| 837 | # The total size of all packets received or sent. Includes |
| 838 | # the effect of compression, frame overhead, and control frames. |
| 839 | self._wire_bytes_in = 0 |
| 840 | self._wire_bytes_out = 0 |
| 841 | self.ping_callback = None # type: Optional[PeriodicCallback] |
| 842 | self.last_ping = 0.0 |
| 843 | self.last_pong = 0.0 |
| 844 | self.close_code = None # type: Optional[int] |
| 845 | self.close_reason = None # type: Optional[str] |
| 846 | |
| 847 | # Use a property for this to satisfy the abc. |
| 848 | @property |