You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to look from the documentation but didn't find any ways to measure the ping to the websocket gateway, any ideas how to measure the latency between receiving the message from the websocket?
The discord.js library has a function named client.ws.ping which, referring to the docs, prints the number that is your latency to the gateway. Don't know how that is implemented.
edit: added latency calculations in the last commit push. You can access the gateway latency by doing bot.gateway.latency. Also you'll have to wait ~30 seconds on the first gateway connection since that's about how much time discum waits until sending a heartbeat.
Close code handling was also added; make sure you update your websocket-client installation since they updated their lib to send close codes :).
edit: closing this as answered. You can access gateway latency by doing bot.gateway.latency.
The text was updated successfully, but these errors were encountered:
Hello!
I tried to look from the documentation but didn't find any ways to measure the ping to the websocket gateway, any ideas how to measure the latency between receiving the message from the websocket?
The discord.js library has a function named client.ws.ping which, referring to the docs, prints the number that is your latency to the gateway. Don't know how that is implemented.
arandomnewaccount:
well, according to discord.py (https://github.com/Rapptz/discord.py/blob/master/discord/shard.py#L261), latency = seconds between a HEARTBEAT and a HEARTBEAT_ACK.
HEARTBEAT is something your client sends (https://github.com/Merubokkusu/Discord-S.C.U.M/blob/master/discum/gateway/gateway.py#L220) and HEARTBEAT_ACK is what discord responds with (opcode 11).
So...it's currently not implemented in discum but when I get some time I can.
edit: added latency calculations in the last commit push. You can access the gateway latency by doing bot.gateway.latency. Also you'll have to wait ~30 seconds on the first gateway connection since that's about how much time discum waits until sending a heartbeat.
Close code handling was also added; make sure you update your websocket-client installation since they updated their lib to send close codes :).
edit: closing this as answered. You can access gateway latency by doing bot.gateway.latency.
The text was updated successfully, but these errors were encountered: