Twitch.tv: Trust check failed

I’m trying to read chat from twitch with the IRC, I have got an example with python but if I attempt to do this in Roblox it says " twitch.tv: Trust check failed"

ExampleOutput1: https://gyazo.com/a6b51f3b0ef3dfdf39995b04959cb2b9
ExampleOutput2: https://gyazo.com/a854437fbe52d6312e714264ee7186db
Error: https://gyazo.com/6fe3b8d744bb5bd9aa05ac6b436461fb

I have looked around dev forum but all of the trust check failed is for Roblox (which I can see)

# example python
server = 'irc.chat.twitch.tv'
nickname = "Test"
port = 6667
token = 'privatel'
channel = '#kitboga'
import socket
import time

sock = socket.socket()
sock.connect((server, port))
sock.send(f"PASS {token}\n".encode('utf-8'))
sock.send(f"NICK {nickname}\n".encode('utf-8'))
sock.send(f"JOIN {channel}\n".encode('utf-8'))
resp = sock.recv(2048).decode('utf-8')
print(resp)
time.sleep(.1)
resp2 = sock.recv(2048).decode('utf-8')
print(resp2)

Output: https://gyazo.com/a854437fbe52d6312e714264ee7186db

-- example lua
local HttpService = game:GetService("HttpService")
local server = "irc.chat.twitch.tv"
local nickname = "Test" .. game.JobId
local token = "Private"
local channel = "#kitboga"

local pass = HttpService:PostAsync(server, "PASS " .. tostring(token) .. "\n", Enum.HttpContentType.ApplicationUrlEncoded, false)
print(pass)

I most likely have done something terribly wrong but i do not know what i have done wrong/how to fix any help will be appreciated!
If you want to run the scripts you need to generate a token/OAuth you can do that here:
https://twitchapps.com/tmi/
(replace “Private” in token with the OAuth that was generated)

Are you sure you are able to use HTTP with the service? The Python example interacts directly with the socket, while the Lua one uses HttpService which expects HTTP headers to be sent and received.

no, I am not sure, I have not seen anyone do this before so I just wrote the code to test which is not working.
From quickly searching I have found two threads
1/2015
1/2019
and it appears web sockets don’t exist in Roblox HTTP (which I believe I need to use)
Edit: it appears the IRC can only work from a socket/websocket

That’s correct. This service clearly requires websockets to work, but Roblox does not support them and iirc it’s not planned.

Chats services (including Discord) generally base on websockets, because it’s easy to create a channel of communication (instead of HTTP long polling). The only one solution is building a web api (proxy) for example in python or node.js. You could do it on glitch (make websocket there and create express server to communicate with your game) and then use HttpService to glitch on Roblox.

3 Likes

Trust checks fail when you don’t have http:// or https:// at the front of a link.
There also currently isn’t a way to hook to sockets without making or using a module which would need to be made and go through a third part website.