I understand Server-Sent Events but in the instructions server is in javascript and I have to be in php. In short, I figured out everything with the client, but about the server there is almost nothing but an example.
- For the connection to open successfully, the server must respond with the header Content-Type: text / event-stream, and then leave the connection hanging and write messages to it in a special format. - What does it mean "the server should respond with the Content-Type: text / event-stream header" I have no idea at all, but in their example the server found what you need: res.writeHead (200, {'Content-Type': 'text / event-stream ',' Cache-Control ':' no-cache '
}); But I don `t know how to implement this on php. - I will ask to give an example of sending a message. Again, in their server, eo looks like this:
res.write('data: ' + ++i + '\n\n');
And I don't know about php.