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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:11:33+00:00 2026-06-14T09:11:33+00:00

Concerning JavaScript & PHP WebSocket TCP packet clumping, with example below. For some reason,

  • 0

Concerning JavaScript & PHP WebSocket TCP packet clumping, with example below.

For some reason, when sending packets quickly on my VPS, or accessing my localhost through a domain pointing at my IP address, multiple packets will clump together. I am trying to stream, for this example, 20 (@100byte) packets per second. On the servers end, they ARE indeed being sent out at a steady rate, exactly every 50ms, making 20 per second.
However, when they get to the client, the client only processes new messages about every 1/4th of a second. Causing new packets only to be received at a rate of 4 per second or so…

What is causing this clumping of packets together? This problem does not occur when everything through localhost. What’s weirder is that it streams smoothly on iPhone’s iOS Mobile Safari, with no problem at all. BUT, it doesn’t work at all on PC Safari, (because I haven’t set this up to work correctly with the old Hixie-76 WebSocket format, I’m assuming Mobile Safari is already using the newer RFC 6455 or newer JavaScript compiler) I have tried multiple hosting companies, with the exact same results each time.

See the example below, hosted on InMotion’s VPS:
http://www.hovel.me/script/serverControl.php

(Click [Connect] on the left, then [View Game] on the right).

The current packet received will jump about 5 every time, as each 5 packets are received at once, every 1/4th of a second. However, I’ve seen examples that can send a constant, quick stream of packets.
What causes this clumping together / packets to wait for each other?

EDIT: This HAS to be something to do with Nagle’s algorithm, which collects & sends small packets together? I’ll work towards trying to bypass this in PHP.
Even with this TCP_NODELAY set in PHP, the problem still stands. Why it works on an iPhone but not a PC is still throwing me off…

EDIT: Setting TCPNoDelay and TcpAckFrequency to 1 in the registry fixes this, but I can’t expect every user to do that. There must be a client-side, bread & butter JavaScript way.

How can I have functionality replicating node.js’ “socket.setNoDelay(true)“, without using node.js?

  • 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-14T09:11:34+00:00Added an answer on June 14, 2026 at 9:11 am

    That’s TCP. It is helping you by economizing on IP packets. Part of it is due to the Nagle algorithm but part of it may also be caused by the intermediate network.

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

Sidebar

Related Questions

I'm working on one application ( using PHP, javascript ). Below is the short
I have some javascript code like below function mask(eventVal,val){ var len = val.value.length; var
I have some questions concerning JavaScript loops. Questions : Why does a JavaScript loop
I have a simple question concerning Javascript. I am trying to print in a
I've got a problem concerning the javascript this keyword when used within a javascript
I am converting an encryption script from PHP to JavaScript and am struggling... The
I am converting a look-up table in PHP which looks like this to JavaScript
Concerning validation, Are javascript and ASP.NET validation used for the same purpose? If yes,
I have a small question concerning css styles and javascript / jquery. Lets say
I have to send a two-dimensional JavaScript Array to a PHP page. Indeed, I'm

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.