The SSE(subscribe a event in Browser) seems not support CORS?

Heya @yuanetking,

Hmm... There are a few questions here, SSE, CORS, and events in general, so assuming that the following works:

  • You can open that url directly, and see events in that browser window?

I think the latest Spark server package allows cross origin requests from everybody, code is here:

https://github.com/spark/spark-server/blob/master/js/main.js#L45-L59

So I'm guessing the issue is more about specifying the specific event name when binding your eventSource object. Checkout this post for an example of how to bind to a specific eventsource topic:

I hope that helps! :slight_smile:

Thanks,
David

1 Like