FAQ Database Discussion Community


server sent events while loop takes so much time for page load, when page is refreshed or F5 is pressed

php,server-sent-events
I am using server sent events to query database for new records and display the events to the user Here is my code javascript window.onload = function setDataSource() { if (!!window.EventSource) { var source = new EventSource("polling.php"); source.addEventListener("message", function(e) { console.log(e.data); }, false); source.addEventListener("open", function(e) { console.log("OPENED"); }, false); source.addEventListener("error",...

.Net Server-Sent Events using HttpHandler not working

asp.net,html5,httphandler,server-sent-events
I have been trying to implement an event driven push to a client browser. I am using ReactiveX to produce the async task from the events but I can't even get my HttpHandlers to output their response. I have tried with a simple HttpHandler: public class Handler2 : IHttpHandler {...

How to fully implement server-sent events for message polling

javascript,php,jquery,polling,server-sent-events
I am trying to communicate with a server using an API. to make it easier I wrote a script that will communicate the API using a php script. My goal is to make a query to the API every second to see if there is new message in their queue....

Not able to access Server-Sent-Events over Mobile 3g Network

nginx,https,proxy,server-sent-events
I am having an issue with Server Sent events. My endpoint is not available on mobile 3G network. One observation I have is that a https endpoint like the one below which is available on my mobile network. https://s-dal5-nss-32.firebaseio.com/s1.json?ns=iot-switch&sse=true But the same endpoint when proxy passed using an nginx and...

ServiceStack 4 compatible Server Sent Events Client for .NET 3.5

c#,.net,.net-3.5,servicestack,server-sent-events
Is there any solution available to communicate with the great Server Side Event (SSE) system implemented in ServiceStack 4 from within a .NET 3.5 client environment? Maybe there's some different client implementation available? The ServiceStack 4 ServerEventsClient and its dependencies like ServiceStack.Text make excessive use of .NET 4.0 features like...

PHP/JS Progress Bar

javascript,php,jquery,ajax,server-sent-events
I'm trying to make a page which will generate a result-set from a complex database query & php parsing... but that's mainly beside the point... The main point is that this takes a minute or two to complete, and I'm hoping to display a progress bar rather then a generic...

Server sent events not send until PHP script execution end

php,apache,server-sent-events
I was successfully using server sent events for several months. Suddenly it stopped working. Now no event is received until server finish execution and then all events are raised at once. Because project is in constant development, I tried from start and it is not working. My client code is:...

Using sse broadcast with jersey, anyway to send an event to a specific EventOutput?

java,jersey,server-sent-events
I have a Restful service where a user can get a new SSE broadcast. The code looks like this: SseBroadcaster sseBroadcaster = new SseBroadcaster(); @GET @Produces(SseFeature.SERVER_SENT_EVENTS) @Path("/getEvent") public EventOutput getSseOutput(@Context HttpServletResponse response) { EventOutput eventOutput = new EventOutput(); sseBroadcaster.add(eventOutput); return eventOutput; } What I'd like to do is when a...

Can I use jquery and AJAX to call a cgi-bin script, then add message event to handle Server Sent Event?

javascript,jquery,ajax,server-sent-events
What I have is a long running cgi-bin program (runs for 3-15 minutes) that I want to call using AJAX. While its running, I'd like to receive Server Sent Event data from it and display it on my web page. Kinda like a progress monitor - but more like a...

SSE loads lots of data and paralyzes AJAX post requests

javascript,php,ajax,pdo,server-sent-events
This is my sse_server.php file include_once 'server_files/init2.php'; //this file includes the connection file to the database and some functions header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); $assocArray = array(); $fetch_article = $dbh->prepare("SELECT article_author_id, article_author_un, article_id, article_cover, article_title, article_desc FROM articles ORDER BY article_id DESC"); $fetch_article->execute(); while ($fetch = $fetch_article->fetch(PDO::FETCH_ASSOC)) { $article_author_id =...

Server-Sent Events Polling causing long delays

javascript,php,jquery,curl,server-sent-events
I have a connector that will call a RESP API using cURL and PHP. I need to call one method every second to check for new messages and then process them. I used the following 2 approaches to handle the messages AJAX Polling using SetInterval(): call the php script once...

Twisted SSE server subscribed to Redis via pubsub

python,redis,twisted,server-sent-events
I'm trying to build a server in Twisted which would let clients connect using Server Sent Events. I would like this server also to listen to Redis and if a message comes then push it to the connected SSE clients. I have the SSE server working. I know how to...

How send Sever Sent Events on POST using PHP?

php,post,server-sent-events
I'm just starting with PHP and Server Sent Events. After checking out a couple of articles,like the W3C and HTML5Rocks one I was able to get something off the ground very fast. What I'm trying to do now is sending a Server Sent Event when my php script receives a...

Firebase REST streaming for multiple users

firebase,server-sent-events,nest-api,firebase-database
I have a server that needs to receive real time updates from Firebase, for multiple users, where each user grants Oauth access to his Firebase data to my app. My server is implemented using Firebase REST Streaming, based on Server Sent Events. I need to know if there is a...

Changing EventSouce event name not working in asp.net

javascript,c#,asp.net-mvc,knockout.js,server-sent-events
i have an asp.net mvc application with knockout.js i'm using HTML5 EventSource for push messages c# private static void UpdateOnlineUsers() { var ou = Clients.Select(c => new { UserName = c.User.Name, Time = c.DateTime.ToString("G") }).ToList(); Clients.ForEach(c => { c.Stream.WriteLine("data:" + new JavaScriptSerializer().Serialize(ou) + "\n\n"); }); } and javascript is eventSource.addEventListener('message',...

Using Server Sent Events in NodeJS not recieving data on client-side

javascript,jquery,node.js,server-sent-events
I have one webpage with text input for one webpage and I want to obtain the information. In the client I have this: function login() { webpage = document.getElementById("webpage").value; alert(webpage); source = new EventSource( "http://localhost:8000/register?name="+webpage, {'Access-Control-Allow-Origin' :'*'} ); source.onmessage = function(event) { var a = event.data; alert(a); }; } In...