@classmethod<EOL><INDENT>async def from_client(cls, client, *, shard_id=None, session=None, sequence=None, resume=False):<DEDENT>
gateway = await client.http.get_gateway()<EOL>ws = await websockets.connect(gateway, loop=client.loop, klass=cls, compression=None)<EOL>ws.token = client.http.token<EOL>ws._connection = client._connection<EOL>ws._dispatch = client.dispatch<EOL>ws.gateway = gateway<EOL>ws.shard_id = shard_id<EOL>ws.shard_count = client._connection.shard_count<EOL>ws.session_id = session<EOL>ws.sequence = sequence<EOL>ws._max_heartbeat_timeout = client._connection.heartbeat_timeout<EOL>client._connection._update_references(ws)<EOL>log.info('<STR_LIT>', gateway)<EOL>await ws.poll_event()<EOL>if not resume:<EOL><INDENT>await ws.identify()<EOL>return ws<EOL><DEDENT>await ws.resume()<EOL>try:<EOL><INDENT>await ws.ensure_open()<EOL><DEDENT>except websockets.exceptions.ConnectionClosed:<EOL><INDENT>log.info('<STR_LIT>', shard_id)<EOL>return await cls.from_client(client, shard_id=shard_id)<EOL><DEDENT>else:<EOL><INDENT>return ws<EOL><DEDENT>
Creates a main websocket for Discord from a :class:`Client`.

        This is for internal use only.