Hi everyone.
I was trying to write a script to display twitch chat in unity, but I was unable to connect to irc.chat.twitch.tv:6667, unity console returns “Server not responding” error.
What could be the reason? Is twitch blocking access requests from certain regions?
Part of my script here:
public async void ConnectToTwitch()
{
Debug.Log(“Connect start”);
tcpClient = new TcpClient();
await tcpClient.ConnectAsync(“irc.chat.twitch.tv”, 6667);
streamReader = new StreamReader(tcpClient.GetStream());
streamWriter = new StreamWriter(tcpClient.GetStream()) { NewLine = "\r\n", AutoFlush = true };
await streamWriter.WriteLineAsync("PASS" + Token);
await streamWriter.WriteLineAsync("NICK" + Token);
Debug.Log("Connection successful");
ReadMessage();
}
Thank you!