We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33968
    • 863 Posts
    The best way to do this is the same way you should do ajax within MODx. Put all of your php code into a snippet in a dedicated resource, use the MODx api wherever possible, then reference that resource as your EventSource in JS:
    // eg. put your snippet in resource '6'
    var source = new EventSource('[[~6]]');
    
      • 37494
      • 8 Posts
      EventSource's response has a MIME type ("text/plain") that is not "text/event-stream". Aborting the connection.


      Using the recourse sets the MIME type ("text/plain")! Any ideas how to override that to "text/event-stream"?