-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with htmx #134
Comments
have you been able to resolve this? |
Nope, I also stopped trying. However, I think I did test a similar setup with FastAPI and that worked out of the box. So, I assume that the issue is that the message format of htmx is different from what django-eventstream expects and I don't have the expertise to look deeper into that. |
At a glance I don't see anything wrong with the code. The "time" example specifies the channel the same way. It's not a format compatibility issue since the error happens before any messages are sent. If you want to debug further you could see if this method is getting called or not and what it is returning. |
a boilderplate htmx setup worked for me with channels 3.0.5:
I added |
work with uvicorn+htmx so easy, thanks this project!
|
Hi, I've been trying to use
django-eventstream
with the htmx sse extension, but can't get it to work quite. I did look into the examples and managed to get those running so the principle environment setup should be fine. I am a beginner for both packages and also django in general so I might miss the obvious.When I start the app and open the page I can see it connecting to the
/events
endpoint successfully. However, in the browser console I keep getting error message. It periodically sends another get-request to/events
and while the returncode is 200 it seems like htmx does not like the response. If I manually go to/events
I get::No I don't know if htmx faces the same issue or if I only get this because my manual request does not specify a channel. Yet I don't even know how I would do that. I understood from the documentation that it is encouraged to use channels and it is somewhat clear how they are defined and how I can send messages to a channel but I don't understand how the client part selects the channel.
Maybe it's a htmx limitation? But even if I don't use channels, I don't get a proper reply. Would appreciate any help or tips. Or maybe I need to bring this question to the htmx github.
I appended the relevant code below:
mydemo/asgi.py
mydemo/settings.py
mydemo/urls.py
server_events/urls.py
server_events/views.py
server_events/templates/server_events/index.html
The text was updated successfully, but these errors were encountered: