n4j1Br4ch1D / onmessage-in-Server-Side-Events-is-not-working

onmessage in SSE(Server Side Events) is not working. This is a potential solution. check simplest demo.

Repository from Github https://github.comn4j1Br4ch1D/onmessage-in-Server-Side-Events-is-not-workingRepository from Github https://github.comn4j1Br4ch1D/onmessage-in-Server-Side-Events-is-not-working

onmessage-in-Server-Side-Events-is-not-working

onmessage in SSE(Server Side Events) is not working. This is a potential solution. check simplest demo.


The Problem is With ServerSideCode:
1-make sure you add correct headers such as : header("Content-Type: text/event-stream");.
2-make sure you set your response to data like this: 'data: your response text'.
3-make sure you add a line break to the end of response text twise like this: "\n\n";.
https://github.com/n4j1Br4ch1D

About

onmessage in SSE(Server Side Events) is not working. This is a potential solution. check simplest demo.


Languages

Language:JavaScript 45.1%Language:PHP 32.8%Language:HTML 22.1%