I have a website that hosts streaming data via socket.io. I’m wondering if it is possible to connect to the socket from within the extension so the extension can receive emits from the server.
If anyone had any idea or experience with this, I’d very much appreciate some illumation!
Yes. As long as you only connect to the host website on secure connections (WSS/TLS) you can use it however you like (as long as it doesn’t break any other TOS, like directly transmitting HTML).
Is there something special I need to do to open the connection? From within the Developer Rig, I’m getting connection refused errors.
Connection refused sounds more like the issue is on your server side rather than the Twitch/Extension/Rig side, but I could be wrong. Does the server accept secure connections? Does it need CORS enabled? I don’t personally have a lot of experience with using sockets in extensions but my template has socketio and it works fine, you can take a look at it here: https://github.com/xzion/twitch-extension-demo
I don’t think AJAX or websockets connections require you to whitelist the domains in the extension config but you could try that as well (Manage -> Extension Capabilities)