What info do I need to send to the twitch api when I establish a connection with godot?

I am trying to make a simple chat thing in godot, and I can establish a connection using a streampeertcp but I cant get it to send and packets to me, It may be because I am sending to the wrong info in the connect to channel method, heres the code:

extends Node

onready var tcpClient = StreamPeerTCP.new()
onready var sent_data = false

const CLIENT_PASS = ‘oauth:REMOVED’
const CLIENT_ID = ‘15m55im9vg81j7zkktxrivz93v22oq’
const CLIENT_NICK = ‘sirgladshoes’

Called when the node enters the scene tree for the first time.

func _process(delta):
print(str(tcpClient.get_status()) + " " + str(tcpClient.get_available_bytes()))
if !tcpClient.is_connected_to_host():
_connect()
_connect_to_channel()

func _connect():
print(“connecting…”)
var err = tcpClient.connect_to_host(“irc.chat.twitch.tv”, 443)
print(err)

func _connect_to_channel():
if tcpClient.get_status() != 2:
pass

print("i see")
tcpClient.put_data(('PASS ' + CLIENT_PASS).to_utf8())
tcpClient.put_data(('NICK ' + CLIENT_NICK).to_utf8())
tcpClient.put_data(('USER' + CLIENT_ID).to_utf8())

I removed and revoked your oAuth token.
These are considered paswords and should not be posted publically

tcpClient.put_data(('PASS ' + CLIENT_PASS).to_utf8())
tcpClient.put_data(('NICK ' + CLIENT_NICK).to_utf8())
tcpClient.put_data(('USER' + CLIENT_ID).to_utf8())

You do not need a NICK command and your user should be the username not the clientID

You also omitted the space after USER

ok ill try this, thanks for the help, sorry im new to this stuff and ill try not to post outh tokens again

It still says that there are zero bytes to be read after sending the data, This may be a problem with godots streampeertcp though.

So when connecting to twitch, before sending anything, you are not able to receive anything at all such as the 001/GLHF messaging?

no, I have it set up so it prints the amount of bytes that it can read and it stays 0 the entire time

Then your problem isn’t a “what am I sending” at connection issue.

Even though that was actually wrong in the first place!

I’m not a gopher so can’t have with the go issue. (but can chime in on the what to send to chat when connecting :smiley: )

Hopefully someone whom knows go will chime in

thanks for your time

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.