I’m fairly new to the whole web dev scene and even python itself. I cant find any examples so I’m assuming the answer is no, but I just wanted to bury this so I can move on and do what I need to do.
Is it possible? I see the example code is for JavaScript. But can the PubSub be used with python?
Sure PubSub is just a socket protocol to deliver data to you.
Since it’s Websockets led, it’s super easy to throw a javascript example up. Just like how Twitch Chat is available over A websocket, so if you can speak websocket you can use PubSub.
Some of the existing Twitch Python libraries probably have support, so use one of those or a Python WebSocket client
Hey I’m looking the same as you to access pubsub using python. I just got this code running, maybe this can help you with the basics. Eventually we need to implement a heartbeat to maintain the connection.
Also, one thing to notice is that when you request your OAuth you need to request the specifics scopes for the topic you want to listen (https://dev.twitch.tv/docs/pubsub#topics)
import websocket
try:
import thread
except ImportError:
import _thread as thread
import time