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 8468681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:00:11+00:00 2026-06-10T16:00:11+00:00

I want to create a two-way stream between a Node.JS client and a Node.JS

  • 0

I want to create a two-way stream between a Node.JS client and a Node.JS server, via an HTTP connection. But it seems that the server’s request event is not called until the client calls req.end(). How can I establish a two-way communication? Do I need to use separate requests?

Clarification: My expectation was that it was possible for

  1. The client to send the request header,
  2. The server to send the response header, and
  3. The server and client to send bytes whenever they want.

Edit: OK, here is the summary of the options:

  • TCP sockets on a separate port: This is good if you don’t mind opening a separate port, and then modifying previous use of HTTP (request path and headers, and response headers) to use the stream instead. (I declined this option.)

  • Separate HTTP requests, ending the request every time you need to flush. Managing the state would be done in the application, because now an ended connection will no longer represent an ended session. (In the short term, I will use this option.)

  • Socket.IO (which is an implementation of WebSockets + reverse compatibility): This option is very appealing, but you need to add the Socket.IO layer to be in front of the HTTP layer. Socket.IO would pass through all HTTP requests, but WebSocket requests would be handled differently. (In the long term, I will use this option, but I will have to modify my front-end to permit this.)

    As I understand it, the Node.JS http library will not allow me to send a response header, unless the client has already completed (or at least substantially began) sending the request body. This I suppose is for good reason, so this third option can also be titled Add a layer in front of the http library.

  • 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-06-10T16:00:13+00:00Added an answer on June 10, 2026 at 4:00 pm

    If you are really looking for a 2-way communication system, HTTP is not really the correct protocol.. The whole idea is that it’s stateless and handled 1 request at a time. There’s exceptions to this rule, but those are really stretching what HTTP is supposed to do, and could be considered hacks.

    It sounds like you should be using something like Socket.IO

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

Sidebar

Related Questions

I want to create two widgets in flex. One for the movies ( that
I want to create a new field (or two) in my table that is
I want to create a view that contains two forms with their submit buttons.
I have problem that I need to create timer but I want to pass
I want to create a two player game on iPad, but I don't really
I have a simple class that handles the connection being made between a client
I want to create a 2 way bind between a listbox and a .NET
I want to create two DATETIME variables I can use to check with BETWEEN
I want to create two equal timestamps for a given day in PHP and
I want to create two and three dimensional vectors using a constructor in a

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.