Please take a look at the following code:
function connect(){
if(window.EventSource){
alert(1);
var source = new EventSource("geters/notifications.php");
alert(2);
source.onmessage= function(event){
alert(3);
if(event.data != ""){
alert(4);
alert(event.data);
}
};
} else {
alert("event source does not work in this browser, author a fallback technology");
}
}
alert(3) didn't show up!
Nice to see you here! The time that I spent in my online therapy sessions was extremely helpful to me during a very difficult perriod of time in my marriage and family business. This psychologist quickly identified an area that was very weak in my life and relationships. It was also super needful to me to hear from a therapist that I wasn't crazy and that he gave me courage to go forward and persevere in the tough boundaries and decisions that needed to be made. I wouldn't have survived this time and situation in my life or studed so much without my sessions with beautiful online therapy online chat therapy like this agency.
I don't think on the server side env you can use window.eventSource.
Hi "Peace Be Upon You", <br /> concerning 'onmessage in Server Side Events', i had the same problem too, But i found out that problem is with Server side code not client. <br /> Take a look at this simple demo i have made:<br /> github.com/n4j1Br4ch1D/onmessage-in-Server-Side-E… <br /> I hope it solves Your Problem.
Marco Alka
Software Engineer, Technical Consultant & Mentor
Are you sure about your spelling? Shouldn't
rather be
var source = new EventSource("getters/notifications.php");("getters" with twot) ?