Hey, this is my code for dealing with data; (I’m using Python 2.7.11)
Attempts a data grab from twitch
self.data = sock.recv(1024)
self.databuffer = self.databuffer + self.data #Appends data received to buffer
self.temp = self.databuffer.rsplit(‘\n’) #Splits buffer into list
self.databuffer = self.temp.pop() #Grabs the last list item and assigns to buffer
This works really well with minimal latency (ignore the “self.”)
For the ping response I see an issue:
PONG :tmi.twitch.tv\r\n
Which should be:
PONG tmi.twitch.tv\r\n
Hopefully this works for you.