You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are connected to our backend service and backend exposes a bidirectional stream which used to for continuous audio streaming. We are facing an problem that this bidirectional stream automatically closes by the backend service by default it gets disconnected if we keep the stream idle for 30 sec(configuration in our backend). So we wont keep the stream idle for more than 30sec.
Still in some rare scenario the stream gets disconnect by the backend service, My question is is there any way to client to get to know about the stream disconnection via any callback? When the service disconnects we get a delegate callback, But I am unable get any details on callback option when the stream disconnects.
Here is our backend protos
service Mic { rpc AudioStream(stream MicRequest) returns (stream MicResponse); rpc SendNoteType(NoteType) returns (google.protobuf.Empty); }
Here is the swift code that connects to the stream
Still in some rare scenario the stream gets disconnect by the backend service, My question is is there any way to client to get to know about the stream disconnection via any callback? When the service disconnects we get a delegate callback, But I am unable get any details on callback option when the stream disconnects.
You can add a callback to the status future which indicates when the RPC has finished. Extending your example this would be something like:
mobileAsMicBidiStream.whenSuccess{ status in// ...}
@glbrntt The bidirectional stream mobileAsMicBidiStream doesn't expose any method whenSuccess, Are you saying whenever I send a message in mobileAsMicBidiStream using the method sendMessage should we listen for success or failure? I have attached the code below
What are you trying to achieve?
We are connected to our backend service and backend exposes a bidirectional stream which used to for continuous audio streaming. We are facing an problem that this bidirectional stream automatically closes by the backend service by default it gets disconnected if we keep the stream idle for 30 sec(configuration in our backend). So we wont keep the stream idle for more than 30sec.
Still in some rare scenario the stream gets disconnect by the backend service, My question is is there any way to client to get to know about the stream disconnection via any callback? When the service disconnects we get a delegate callback, But I am unable get any details on callback option when the stream disconnects.
Here is our backend protos
service Mic { rpc AudioStream(stream MicRequest) returns (stream MicResponse); rpc SendNoteType(NoteType) returns (google.protobuf.Empty); }
Here is the swift code that connects to the stream
mobileAsMicBidiStream = mobileAsMicClient.audioStream(handler: { response in self.serialResponseQueue.async { self.micResponseHandler.handleMicResponse(micResponse: response, stream: self) } })
What have you tried so far?
Tried searching for any callbacks on stream disconnection but couldn't find any details on that.
The text was updated successfully, but these errors were encountered: