Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check client connection status in Server #91

Open
mohammadnejad opened this issue Nov 27, 2019 · 4 comments
Open

Check client connection status in Server #91

mohammadnejad opened this issue Nov 27, 2019 · 4 comments

Comments

@mohammadnejad
Copy link

Hello, In bidirectional streaming How I can check client connection status? I am developing multiplayer online game with your library and I want to know when one player disconnect and notify to other players?

@marcoferrer
Copy link
Owner

marcoferrer commented Nov 27, 2019

I’ll be able to give you a more explicit answer a little later. But in the mean time this example might be of some use. It’s a demo of a multi-player game for a talk. leveretka/grpc-death-star#3

I know for sure that if a client disconnects it will send a cancellation to the server that can be handled and used to notify the other subscribers

@mohammadnejad
Copy link
Author

Yes, when client disconnects I handle cancellation notification and everything is OK, but when internet in client disconnects, client can't send cancellation notification to server and I can't handle it.

@marcoferrer
Copy link
Owner

When the network disconnects the grpc server should invoke the cancellation callback as well. I havent tried it explicitly but it is mentioned in ServerCall.onCancel()

@mohammadnejad
Copy link
Author

I handle the problem with config keepalivetime and keepalivetimout. Server ping client every 20 seconds and when the network disconnects the server close stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants