discord.gateway_connection module

class discord.gateway_connection.GatewayConnection(wslib=<module 'websocket' from '/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/websocket/__init__.py'>, logging=<module 'logging' from '/opt/python/3.6.3/lib/python3.6/logging/__init__.py'>)[source]

Bases: object

ENDPOINT = 'wss://gateway.discord.gg/?v=6&encoding=json'
endpoint
connected
open()[source]

Opens a websocket connection to the gateway.

Raises:ValueError – When the gateway connection is already open.
close()[source]

Closes the websocket connection.

receive_payload()[source]

Receives a payload packet from the websocket and stores its sequence number.

Returns:A Payload object.
send_payload(payload)[source]

Sends a payload packet to the gateway.

Parameters:payload – A Payload object.