Twitch.tv Chat integration & Viewer list example.

  • I made an example project, which demonstrates how to connect to Twitch.tv channel, send and receive messages, and fetch viewer list using Websockets and Ajax object.

    It uses Yann's JSON plugin for parsing viewerlist json.

    http://bit.ly/c2twitch_example

  • Where is your CHANNEL variable assigned?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • -

  • I think your compare condition might be screwing with stuff too, I would remove that altogether and see if it works. The WebSocket.MessageText == PING... one. Make it so that it sends the message regardless of what is typed into the box. No need to be artificially constraining yourself when you are debugging.

  • -

  • Well, you will replace that eventually (or rather get rid of that PINGPONG message altogether) once it is working... I think it is working right now, based on your Construct code. It doesn't send your PING message because of the code. You specifically tell it to ONLY send the message IF the message equals EXACTLY: "PING :tmi.twitch.tv", so if you just type in "PING", it will fail to send that message.

    It will still send your other message (the sendInput.Text one) though, which it does, but only when you click the button (not if you press enter).

  • -

  • Well, from your screenshot it looks like it connects and sends messages fine. I guess I don't see how you are having problems when it does exactly what you tell it to.

  • -

  • -

  • Has anybody actually used C2 for any interactive twitch games?

    I think you are the first.

    For myself, I have full control of both the websocket server and client, which makes my life easier in that respect.

  • -

  • Alright i got it working, turns out the ip i had was for irc events only and didnt allow for actually anything other than initial connection, working websocket ip for twitch chat is ws://irc-ws.chat.twitch.tv:80 in case people are interested

    Is there any chance you could post a capx example of your updated twitch code?

    Edit: I've got it working <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> the reviving messages side anyway, though I haven't managed to get the sending side working.

    Great job on this, so simple but effective, opens up some serious possibilities!

  • -

  • >

    > > Alright i got it working, turns out the ip i had was for irc events only and didnt allow for actually anything other than initial connection, working websocket ip for twitch chat is ws://irc-ws.chat.twitch.tv:80 in case people are interested

    > >

    > Is there any chance you could post a capx example of your updated twitch code?

    >

    > Edit: I've got it working <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> the reviving messages side anyway, though I haven't managed to get the sending side working.

    >

    > Great job on this, so simple but effective, opens up some serious possibilities!

    >

    I'll upload a capx of the project next week. The message parsing isn't perfect, but it can send and receive messages, fires event when user joins/leaves the channel, list all chatters.

    Awesome, I look forward to it!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)