theelims / ESP32-sveltekit

A simple and extensible framework for ESP32 based IoT projects with a feature-rich, beautiful, and responsive front-end build with Sveltekit, Tailwind CSS and DaisyUI. This is a project template to get you started in no time with a fully integrated build chain.
https://theelims.github.io/ESP32-sveltekit/
Other
118 stars 22 forks source link

EventSource's response has a MIME type ("text/html") that is not "text/event-stream". #60

Open dkaukov opened 3 months ago

dkaukov commented 3 months ago

Hi, after forking template and bulding it with default settings. Im getting lot of

Attempting SSE connection.
demo/:1 EventSource's response has a MIME type ("text/html") that is not "text/event-stream". Aborting the connection.

It seems like /events endpoint responds with default html:

image

Any pointers where to dig?

theelims commented 3 months ago

This seems to be browser specific. It works on Firefox. Might be the naming "EventSource" is problematic and it mistakes it with the build in event source which uses server sent events instead of websocket.

You could try renaming the svelte EventSource into something different.

I'll look into that later today.

dkaukov commented 3 months ago

Yeah, the request from Chrome, seems missing:

Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: xy4LT/rAJ+VJ+D1LIAgGgQ==
Connection: keep-alive, Upgrade
Upgrade: websocket
atassumer commented 2 months ago

it's try to connect websocket connection to /events, but it must be /ws/events, delete www* .h file and build interface