| 260 | |
| 261 | class Connection(EventEmitter): |
| 262 | def __init__( |
| 263 | self, |
| 264 | dispatcher_fiber: Any, |
| 265 | object_factory: Callable[[ChannelOwner, str, str, Dict], ChannelOwner], |
| 266 | transport: Transport, |
| 267 | loop: asyncio.AbstractEventLoop, |
| 268 | local_utils: Optional["LocalUtils"] = None, |
| 269 | ) -> None: |
| 270 | super().__init__() |
| 271 | self._dispatcher_fiber = dispatcher_fiber |
| 272 | self._transport = transport |
| 273 | self._transport.on_message = lambda msg: self.dispatch(msg) |
| 274 | self._waiting_for_object: Dict[str, Callable[[ChannelOwner], None]] = {} |
| 275 | self._last_id = 0 |
| 276 | self._objects: Dict[str, ChannelOwner] = {} |
| 277 | self._callbacks: Dict[int, ProtocolCallback] = {} |
| 278 | self._object_factory = object_factory |
| 279 | self._is_sync = False |
| 280 | self._child_ws_connections: List["Connection"] = [] |
| 281 | self._loop = loop |
| 282 | self.playwright_future: asyncio.Future["Playwright"] = loop.create_future() |
| 283 | self._error: Optional[BaseException] = None |
| 284 | self.is_remote = False |
| 285 | self._init_task: Optional[asyncio.Task] = None |
| 286 | self._api_zone: contextvars.ContextVar[Optional[ParsedStackTrace]] = ( |
| 287 | contextvars.ContextVar("ApiZone", default=None) |
| 288 | ) |
| 289 | self._local_utils: Optional["LocalUtils"] = local_utils |
| 290 | self._tracing_count = 0 |
| 291 | self._closed_error: Optional[Exception] = None |
| 292 | |
| 293 | @property |
| 294 | def local_utils(self) -> "LocalUtils": |