grpc / grpc/grpc-web

Add “connected” hook for streaming clients

Open
#753 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
9.3k
Forks
802
Avg merge
1d 7h
Merged PRs (30d)
5

Description

Currently, grpc-web has data, status, error, and end hooks for streaming clients. In my use case, I need to keep track of whether or not I'm currently holding a functional streaming connection with my backend, and I want to derive a connection status (connected/disconnected) from that.

If the backend is unreachable, the error or end hook gets called, but it's impossible to determine whether the connection has actually been established until I actually receive a message (or the error/end hook gets called). This could be solved by providing another hook that is called once the connection has successfully been established.

Workarounds consist in using a timeout after which, lacking any error/end hook call, I consider the streaming connection established, but that's cumbersome and needn't necessarily reflect the truth, or in modifying the backend to send some sort of ping message right after having accepted a client connection, but that of course depends on the ability to modify the backend and likewise is rather ugly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.