Pregunta

I'm new to this streaming/http long living connection stuff.

This is what I got so far:

var accessToken = require('./config.js').accessToken
  , https = require('https')
;

var req = https.request({
      host: 'alpha-api.app.net',
      path: '/stream/0/posts/stream/global',
      port: 443,
      method: 'GET',
      headers: {
        'Authorization': 'Bearer ' + accessToken,
      }}).on('response', function(response) {
        response.on('data', function(chunk) {
          console.log(chunk);
        })
      });
req.end();

req.on('error', function(e) {
  console.error(e);
})

I was expecting this to run as long as possible and fetching updates as they drop in. But It turns out this terminates after a couple of seconds.

What am I missing?

¿Fue útil?

Solución

Streams are not yet implemented in App.net see https://github.com/appdotnet/api-spec/blob/master/resources/streams.md

The API call you're making is only for the 20 most recent posts in the global stream: https://github.com/appdotnet/api-spec/blob/master/resources/posts.md#retrieve-the-global-stream

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top