PING twitch chat bot

As per the docs.

About once every five minutes, the server will send you a PING . To ensure that your connection to the server is not prematurely terminated, reply with PONG .

You should reply to a PING with a PONG

But you should also send your OWN PINGs to which Twitch will PONG in case you missed a PING/PONG this’ll help keep your connection alive.

Also shouldn’t your code be

s.send(s, line.replace(“PING”, “PONG”))

As otherwise it tries to replace PING with a undefined variable?