diff --git a/tornado/websocket.py b/tornado/websocket.py index 2e1eed4728..434626f6f2 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -1360,7 +1360,7 @@ def __init__( subprotocols: Optional[List[str]] = None, resolver: Optional[Resolver] = None, ) -> None: - self.connect_future = Future() # type: Future[WebSocketClientConnection] + self.connect_future = Future() # type: Union[Future[WebSocketClientConnection], None] self.read_queue = Queue(1) # type: Queue[Union[None, str, bytes]] self.key = base64.b64encode(os.urandom(16)) self._on_message_callback = on_message_callback