简体   繁体   中英

How to use SSE(server sent event) in nuxt.js

If I don't used express, can I use SSE? when I used

context.eventSource = new EventSource(`/`);

I have an error EventSource's response has a MIME type ("text/html") that is not "text/event-stream". Aborting the connection. EventSource's response has a MIME type ("text/html") that is not "text/event-stream". Aborting the connection.

I don't know what eventSource url can I use. I guess.vue file can't be used for SSE

Can anyone help me? Really thanks.

You have to set the content type response header to be "text/event-stream"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM