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

  • SEARCH
  • Home
  • 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 3488084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:13:39+00:00 2026-05-18T11:13:39+00:00

I am trying to create a server-side solution which periodically pushes data to the

  • 0

I am trying to create a server-side solution which periodically pushes data to the client (no client-side polling) via node.js. The connection should be open permanently and whenever the server has new data, it pushes it down to the client.

Here is my simple sample script:

var sys = require('sys'),
http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/html'});
    sys.puts('Start sending...');

    setInterval(function(){
        res.write("<script type='text/javascript'>document.write('test<br>')</script>");
    }, 10000);
}).listen(8010);

This basically works, but it seems that only one client at a time can be connected.

If I open http://127.0.0.1:8010/ with my browser I see every 10 seconds the new output written. But when I open another tab with the same url, it just loads forever. Only if I close the first tab, I get conent from the server.

What do I need to do in order to server multiple clients?

  • 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-18T11:13:40+00:00Added an answer on May 18, 2026 at 11:13 am

    This is definitely a bug, what happens is that the Browser re-uses the same connection due to keep-alive and HTTP/1.1 and Node screws up.

    You can see this at work in Opera11, open the page twice, it’s the exact same page, using the exact same connection.

    Curl and everything that doesn’t set Connection: keep-alive works just fine, but Browsers fail to open the same page twice. Although you can open ‘localhost:8010’ and ‘localhost:8010/foo’ and it will work on both pages.

    Note: This only affects GET requests, POST requests work just fine since there’s no re-using of the connection.

    I’ve filed an issue on this.

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

Sidebar

Related Questions

I am trying to create a client - server application, the client written in
Developing server side code i finally got my eyes X-crossed trying to write -
I'm trying to integrate NHibernate.Validator with ASP.NET MVC client side validations, and the only
I need to create n-tier application with the following parts: Data server Business logic
Hi i'm trying to create a sever/client program that takes up to 5 clients
I'm trying to create a mosaic type script in Javascript and PHP, which makes
I'm trying create a box in my Django app that displays text (and possibly
I am trying to create an application to print documents over the web. I
I'm trying to figure out the best way to validate data within a MVC
Im totally new to WCF. Trying to create a Silverlight application with WCF services.

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.