fanout / django-eventstream

Server-Sent Events for Django
MIT License
664 stars 88 forks source link

Client keep sending requests even if it receives a refuse answer #112

Closed housUnus closed 1 year ago

housUnus commented 1 year ago

Clients that don't satisfy some conditions must not receive messages, but even if the client connection is refused, it keeps sending a request which is very annoying. "HTTP GET /events/_admins/ 400 [0.00, 127.0.0.1:51739]" "HTTP GET /events/_admins/ 200 [0.00, 127.0.0.1:51739]"

My channel Manager: class MyChannelManager(DefaultChannelManager): def can_read_channel(self, user, channel):

require auth for prefixed channels

    if channel.startswith('_') and user is None:
        return False
    return Tr
jkarneges commented 1 year ago

Hi @housUnus, this is really up to the client code. It should close the connection after receiving a stream-error, for example: https://github.com/fanout/django-eventstream/blob/master/examples/time/timeapp/templates/timeapp/home.html#L38-L39

housUnus commented 1 year ago

Thanks this resolved the issue.