Delay until server-sent events runEvent binding on dynamically created elements?How do I implement basic “Long Polling”?Convert HTML + CSS to PDF with PHP?How to debug JavaScript / jQuery event bindings with Firebug or similar tools?What's the difference between '$(this)' and 'this'?How to decide when to use Node.js?WebSockets vs. Server-Sent events/EventSourceIs the recommendation to include CSS before JavaScript invalid?What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?Server-sent events and php - what triggers events on the server?
When were female captains banned from Starfleet?
Freedom of speech and where it applies
Existing of non-intersecting rays
Closed-form expression for certain product
How to explain what's wrong with this application of the chain rule?
Create all possible words using a set or letters
Is it possible to put a rectangle as background in the author section?
Added a new user on Ubuntu, set password not working?
How can "mimic phobia" be cured or prevented?
Is there a name for this algorithm to calculate the concentration of a mixture of two solutions containing the same solute?
Count the occurrence of each unique word in the file
Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?
Can I sign legal documents with a smiley face?
Why should universal income be universal?
Not using 's' for he/she/it
Problem with TransformedDistribution
Why electric field inside a cavity of a non-conducting sphere not zero?
Loading commands from file
Is the U.S. Code copyrighted by the Government?
How should I respond when I lied about my education and the company finds out through background check?
Has any country ever had 2 former presidents in jail simultaneously?
What is the evidence for the "tyranny of the majority problem" in a direct democracy context?
The IT department bottlenecks progress. How should I handle this?
What should you do when eye contact makes your subordinate uncomfortable?
Delay until server-sent events run
Event binding on dynamically created elements?How do I implement basic “Long Polling”?Convert HTML + CSS to PDF with PHP?How to debug JavaScript / jQuery event bindings with Firebug or similar tools?What's the difference between '$(this)' and 'this'?How to decide when to use Node.js?WebSockets vs. Server-Sent events/EventSourceIs the recommendation to include CSS before JavaScript invalid?What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?Server-sent events and php - what triggers events on the server?
I'm building my very first server-sent events implementation using this tutorial https://www.w3schools.com/html/html5_serversentevents.asp
Works fine. But it takes up to 40 seconds until the first message is being sent. How can I get this faster?
javascript php server-sent-events
add a comment |
I'm building my very first server-sent events implementation using this tutorial https://www.w3schools.com/html/html5_serversentevents.asp
Works fine. But it takes up to 40 seconds until the first message is being sent. How can I get this faster?
javascript php server-sent-events
add a comment |
I'm building my very first server-sent events implementation using this tutorial https://www.w3schools.com/html/html5_serversentevents.asp
Works fine. But it takes up to 40 seconds until the first message is being sent. How can I get this faster?
javascript php server-sent-events
I'm building my very first server-sent events implementation using this tutorial https://www.w3schools.com/html/html5_serversentevents.asp
Works fine. But it takes up to 40 seconds until the first message is being sent. How can I get this faster?
javascript php server-sent-events
javascript php server-sent-events
asked Mar 7 at 7:39
AlexAlex
362
362
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Instead of flush();
use @ob_flush();flush();
ob_flush()
(see http://php.net/manual/en/function.ob-flush.php) will send it out of PHP's own buffers, and then flush()
tells the web server (e.g. Apache) to send it on to the client.
If that does not work, then you'll need to describe more about your environment (which web server, which php version, which browsers you've tried it with, what other load balancers might be involved, etc., etc.)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038430%2fdelay-until-server-sent-events-run%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Instead of flush();
use @ob_flush();flush();
ob_flush()
(see http://php.net/manual/en/function.ob-flush.php) will send it out of PHP's own buffers, and then flush()
tells the web server (e.g. Apache) to send it on to the client.
If that does not work, then you'll need to describe more about your environment (which web server, which php version, which browsers you've tried it with, what other load balancers might be involved, etc., etc.)
add a comment |
Instead of flush();
use @ob_flush();flush();
ob_flush()
(see http://php.net/manual/en/function.ob-flush.php) will send it out of PHP's own buffers, and then flush()
tells the web server (e.g. Apache) to send it on to the client.
If that does not work, then you'll need to describe more about your environment (which web server, which php version, which browsers you've tried it with, what other load balancers might be involved, etc., etc.)
add a comment |
Instead of flush();
use @ob_flush();flush();
ob_flush()
(see http://php.net/manual/en/function.ob-flush.php) will send it out of PHP's own buffers, and then flush()
tells the web server (e.g. Apache) to send it on to the client.
If that does not work, then you'll need to describe more about your environment (which web server, which php version, which browsers you've tried it with, what other load balancers might be involved, etc., etc.)
Instead of flush();
use @ob_flush();flush();
ob_flush()
(see http://php.net/manual/en/function.ob-flush.php) will send it out of PHP's own buffers, and then flush()
tells the web server (e.g. Apache) to send it on to the client.
If that does not work, then you'll need to describe more about your environment (which web server, which php version, which browsers you've tried it with, what other load balancers might be involved, etc., etc.)
answered Mar 10 at 4:58
Darren CookDarren Cook
17.2k869160
17.2k869160
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038430%2fdelay-until-server-sent-events-run%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown