grpc-swift icon indicating copy to clipboard operation
grpc-swift copied to clipboard

Checking connection state on async calls

Open ismail9001 opened this issue 1 year ago • 1 comments

How can I check the connection status for asynchronous calls?

I tried use ConnectivityStateMonitor but caught error 'ConnectivityStateMonitor' initializer is inaccessible due to 'internal' protection level, although ConnectivityStateMonitor is public public class ConnectivityStateMonitor: @unchecked Sendable {

ismail9001 avatar Feb 16 '24 09:02 ismail9001

Calls don't have a connectivity state as calls are multiplexed on connections. A connection has a connectivity state. The connectivity state monitor is only available via the connectivity property on ClientConnection. It isn't available on the connection pool.

Generally speaking it isn't that useful to check the connectivity state: if you start a call and no connection is available then one will be established and the call will be queued.

glbrntt avatar Feb 16 '24 09:02 glbrntt