Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26961

How do I change the tracking keyword for a twitter stream using the app.get()

Newsgroups comp.lang.javascript
Date 2015-03-03 02:33 -0800
Message-ID <38ee1925-dfed-4cc9-a2a8-4ba5ea028e35@googlegroups.com> (permalink)
Subject How do I change the tracking keyword for a twitter stream using the app.get()
From aryaksengupta@gmail.com

Show all headers | View raw


Hi everyone, 

I am new to Nodejs and Socket.io. I have worked through a tutorial which describes how both the technologies work together. The link to the tutorial is this :--- >  Build a real-time Twitter stream 

and the code for the tutorial is posted at github :---> Code of react-tweets. 

Everything works fine in the tutorial and I also have no issues in understanding the code since the code is well commented.

 In the server.js file, the tracking keyword which is "javascript" is manually fed into the "twit" object. i.e. here is the code for it. 

twit.stream('statuses/filter',{ track: 'javascript'}, function(stream){
  streamHandler(stream,io);
});

But I want to make a minor alteration in the code to make the application a bit more versatile. I want to change the tracking keyword dynamically using the URL entered by the user.

For example, if the URL entered is http://localhost/football, then automatically I want the track keyword to be changed to "football". The code should look like 

twit.stream('statuses/filter',{ track: 'football'}, function(stream){
  streamHandler(stream,io);
});

Now, I tried to set this object inside the app.get("/cricket", twit.stream.......); function but I get an error "Expected callback got object" . 

How do I change the above mentioned code to achieve this?. Please let me know. 

Thanks a lot. 

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

How do I change the tracking keyword for a twitter stream using the app.get() aryaksengupta@gmail.com - 2015-03-03 02:33 -0800
  Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-03 13:01 +0100
    Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 07:43 -0800
      Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 17:37 +0100
        Re: How do I change the tracking keyword for a twitter stream using the app.get() "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-04 18:42 +0100
          Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 19:46 +0100
            Re: How do I change the tracking keyword for a twitter stream using the app.get() "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-04 20:29 +0100
              Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 20:39 +0100
                Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 12:26 -0800
        Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 11:35 -0800
          Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 20:44 +0100
            Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 12:44 -0800
            Re: How do I change the tracking keyword for a twitter stream using the app.get() "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-04 21:52 +0100
  Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 07:28 -0800

csiph-web