Trouble getting started with the PubSub sample

I plan on creating a simple application that receives PubSub messages and saves them in a database.

I have already done this for IRC messages with the official python chat code sample but I am having trouble doing this for the official javascript pubsub sample.

What I did:

  1. I set my client id correctly in main.js and set my redirect URI to ‘https:\localhost’ which matches the setting in my application dashboard.
  2. I opened the index.html file in firefox, authorized myself by clicking on the ‘Connect with Twitch’ button and arrived here:

    I don’t understand where I get the PubSub messages from, the ‘index.html’ file defines a form for choosing topics but I never see it, does someone have some guidance for me on where I am going horribly wrong?

You have your access token showing in your screenshot. I would recommend revoking it immediately.

You probably don’t have a web server running on the PC where you are making the request so you are getting “unable to connect”.

2 Likes

Thanks @george, I’ve fleshed out the exact steps in case another user needs more information.

  1. set the redirectURI variable in main.js to http://localhost:3000.
  2. set the redirect URI in your twitch app dashboard to http://localhost:3000.
  3. install nodejs.
  4. open a terminal and run npm install http-server -g.
  5. cd into pubsub-samples/javascript.
  6. run http-server -p 3000.
  7. open http://localhost:3000 in your web browser.

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