Skip to content

How to detect client timeouts/disconnects when implementing long polling #1724

@frankosterfeld

Description

@frankosterfeld

We're implementing a long polling scheme where the client sends a request, and the server blocks in the request handler until a server-side event occurs. The client has keep-alive enabled, and a 10s read timeout. To not block the worker thread forever/longer than needed, I'd like to detect the client disconnect, so that the request handler can periodically check for that, and abort waiting for the server-side event if the client connection is gone.

I see no API for that, is that missing, or by design?

(Alternatively, or in addition, I could implement a server-side timeout when waiting for the event, with the disadvantage that it might differ from the timeout used by the client, and that other disconnects wouldn't be detected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions