Python BOT keeps disconnecting, even with PONGs

I used to have this:

readbuffer = “”

while True:
readbuffer = readbuffer + s.recv(1024).decode(“utf-8”)
temp = str.split(readbuffer, “\n”)
readbuffer = temp.pop()

to generate the server message, but this had the same issue as I’m having right now.