Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6878165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:41:25+00:00 2026-05-27T04:41:25+00:00

I want to pull posts from a users Facebook wall. The following code snippet

  • 0

I want to pull posts from a users Facebook wall.

The following code snippet works, but it never terminates:

var https = require('https');

facebookWall = function(user) {
  var options = {
    host: 'graph.facebook.com',
    port: 443,
    path: '/me/home?access_token=' + user.facebook_token + '&since=' + encodeURIComponent(user.facebook_timestamp),
    method: 'GET',
    headers: {
      'Connection':'keep-alive'
    }
  };

  var req = https.request(options)
  .on('response', function(response) {
    var body = '';
    response.on('data', function(data) {
      body += data;
      try {
        var wallPosts = JSON.parse(body);
        console.log("user " + user.id + " has " + wallPosts.data.length + " new items on their wall");
      }
      catch (e) {
        //console.log("waiting for more data chunks...");
      }
    })
  });
  req.end();

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

I think it is caused by the 'Connection':'keep-alive' header. When I replace it with 'Connection':'close' the script will terminate when all data has been retrieved from facebook.

I’m hoping to be able to use the keep-alive header to prevent having to create a new SSL connection for each request. I have thousands of requests and with the keep-alive header, it completes in just a few seconds, as opposed to a few minutes without the keep-alive header.

Does anyone know how to accomplish this? I’m fairly new to Node.JS, so if I’m missing something obvious, I apologize.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:41:25+00:00Added an answer on May 27, 2026 at 4:41 am

    It’s because keep-alive is not yet implemented for https/tls/ssl
    in node 4.x and I believe for 6.x too. That’s why in node websocket-server
    it doesn’t work as well, see https://github.com/nephics/node-websocket-server/commit/3a732bff6aabe694834d87086a7718be7c0ce138

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a remote monotone repos I want to pull from, but I really
I'm looking to pull the latest posts from a series of specific users. In
I have a multidocument application. I want to pull data from each of those
I've forked a Mercurial repository, and now I want to pull the changes from
If I have two public functions and I want to pull a variable from
So I have my blog set up to pull posts from my database in
I am using the following PHP and MySQL code to pull high score records
I want to pull a series of relationships out of xml files and transform
I want to pull out duplicate records in a MySQL Database. This can be
I have a div with width 600 px. I want to pull the images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.