Django eventstream - only empty data

I installed and followed the guide from the git, but I hit a wall once I try to execute a send_message() call using the shell.

I rewrote the asgi.py:

application = ProtocolTypeRouter({
    "http": URLRouter([
        path("msgs/", AuthMiddlewareStack(URLRouter(django_eventstream.routing.urlpatterns)), { "format-channels": ["test"] }),
        re_path(r"", get_asgi_application()),
    ]),
})

and I created the entries in urls.py:

urlpatterns = [path("msgs/", include(django_eventstream.urls), {'format-channels': ["test"]})]

I also added the static ressources to my static directory and I can access them on any page that includes my base.html. But when I open the local msgs channel at 127.0.0.1\msgs\ I only see:

enter image description here

When opening a shell in a second terminal and using send_event("test", "message", {"text": "hello"}) I see no indication whatsoever that anything is sent out to the frontend. Also the JS sample code from the repo fetches nothing on the main page when sending out data in a loop with starting django (using the fantastic scheduler huey here):

@periodic_task(crontab(minute = "*/1"))
def test():
    send_event('test', 'message', {'text': 'hello world'})
    print("hello world...")

I see the output of print() but not the result of send_message() on the frontend. Also, there is no implication that my scheduled or manually run send_message() actions result in anything on the \msgs\ channel - the timing does not fit, it looks more like this is just regularly printing keep-alive with no data in it.

Back to Top