Websocket Server Connection Issues

There has been a lot of websocket connection issues lately in my app. I am not using TMI.JS to connect, but there is an open ticket under their repository as well. Since I am not using theirs, and they are experiencing the same issue, I want to believe this may be an issue with the service itself either denying or dropping connections.

Having similar issues with my app that is listening to PubSub topics.
Ping and Pong messages work just fine but then suddenly I get an error saying something like

Connection forcibly closed by remote host

Those errors started a few days ago and they seem to occur at random times. Sometimes 15 minutes after connecting and next time a few hours later.

1 Like

I just did a lot of testing today, if you use the API it only shows the WS server with port 80. The WSS server is not on the list. I think the secure server is down.


That’s an undocumented API so you can’t really tell anything from lack of information in it. wss://irc.chat.twitch.tv:443 is very much up and it is the endpoint used by browsers on the website.

Are you listening for the “RECONNECT” event on PubSub and handling accordingly?

Connection Management:

Clients may receive a RECONNECT message at any time. This indicates that the server is about to restart (typically for maintenance) and will disconnect the client within 30 seconds. During this time, we recommend that clients reconnect to the server; otherwise, the client will be forcibly disconnected.```

The secure websocket servers should be up.

    code/:$ wscat -c 'wss://irc-ws.chat.twitch.tv:443'
    connected (press CTRL+C to quit)
    > PASS foobar
    > NICK justinfan123
    < :tmi.twitch.tv 001 justinfan123 :Welcome, GLHF!
    :tmi.twitch.tv 002 justinfan123 :Your host is tmi.twitch.tv
    :tmi.twitch.tv 003 justinfan123 :This server is rather new
    :tmi.twitch.tv 004 justinfan123 :-
    :tmi.twitch.tv 375 justinfan123 :-
    :tmi.twitch.tv 372 justinfan123 :You are in a maze of twisty passages, all alike.
    :tmi.twitch.tv 376 justinfan123 :>

    > CAP REQ :twitch.tv/tags
    < :tmi.twitch.tv CAP * ACK :twitch.tv/tags

    > CAP REQ :twitch.tv/commands
    < :tmi.twitch.tv CAP * ACK :twitch.tv/commands

    > JOIN #twitchplayspokemon
    < :justinfan123!justinfan123@justinfan123.tmi.twitch.tv JOIN #twitchplayspokemon

    < @broadcaster-lang=;emote-only=0;followers-only=-1;r9k=0;slow=0;subs-only=0 :tmi.twitch.tv ROOMSTATE #twitchplayspokemon

    < :justinfan123.tmi.twitch.tv 353 justinfan123 = #twitchplayspokemon :justinfan123
    :justinfan123.tmi.twitch.tv 366 justinfan123 #twitchplayspokemon :End of /NAMES list

    < @badges=;color=#2E8B57;display-name=Darkranger7;emotes=;id=d291d86e-ae45-41a6-8337-80467328d6c5;mod=0;room-id=56648155;subscriber=0;tmi-sent-ts=1490898046619;turbo=0;user-id=72031669;user-type= :darkranger7!darkranger7@darkranger7.tmi.twitch.tv PRIVMSG #twitchplayspokemon :!c

    < @badges=;color=#FF69B4;display-name=davedobbs;emotes=;id=bfef4ba3-e816-4ee5-9136-29795c84f805;mod=0;room-id=56648155;sent-ts=1490898048493;subscriber=0;tmi-sent-ts=1490898048484;turbo=0;user-id=30783390;user-type= :davedobbs!davedobbs@davedobbs.tmi.twitch.tv PRIVMSG #twitchplayspokemon :!bet 100 red

    < @badges=;color=#FF69B4;display-name=Wahisietel_the_Cake;emotes=33:10-17;id=60869ed1-ff37-45ca-8068-87965bfdf2d6;mod=0;room-id=56648155;sent-ts=1490898046587;subscriber=0;tmi-sent-ts=1490898050196;turbo=0;user-id=47718369;user-type= :wahisietel_the_cake!wahisietel_the_cake@wahisietel_the_cake.tmi.twitch.tv PRIVMSG #twitchplayspokemon :FAKE NEWS DansGame

Yes, my app is listening for RECONNECT. It tries to reconnect 3 seconds after receiving it.
But, I was looking at the raw messages and never received it once. It simply closed the connection.

It hasn’t happened within the last 19h though. Maybe it was some kind of hiccup

1 Like

WSS is working for me again now, but yesterday only WS was working. I think it was just a server hiccup.

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