File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55Events that result from processing data on a WebSocket connection.
66"""
7+
78from __future__ import annotations
89
910from abc import ABC
@@ -193,7 +194,7 @@ def response(self) -> CloseConnection:
193194 return CloseConnection (code = self .code , reason = self .reason )
194195
195196
196- T = TypeVar ("T" , bytes , bytearray , str )
197+ T = TypeVar ("T" , bytes | bytearray , str )
197198
198199
199200@dataclass (frozen = True )
@@ -242,26 +243,24 @@ class TextMessage(Message[str]): # pylint: disable=unsubscriptable-object
242243 and reassemble these chunks to get the full message.
243244 """
244245
245- data : str
246-
247246
248247@dataclass (frozen = True )
249- class BytesMessage (Message [bytearray ]): # pylint: disable=unsubscriptable-object
248+ class BytesMessage (
249+ Message [bytearray | bytes ] # pylint: disable=unsubscriptable-object
250+ ):
250251 """
251252 Fired when a data frame with BINARY payload is received.
252253
253254 Fields:
254255
255256 .. attribute:: data
256257
257- The message data as bytearray, can be decoded as UTF-8 for
258+ The message data as bytes or a bytearray, can be decoded as UTF-8 for
258259 TEXT messages. This only represents a single chunk of data and
259260 not a full WebSocket message. You need to buffer and
260261 reassemble these chunks to get the full message.
261262 """
262263
263- data : bytearray
264-
265264
266265@dataclass (frozen = True )
267266class Ping (Event ):
You can’t perform that action at this time.
0 commit comments