grpc reconnect

55 views
Skip to first unread message

shafat...@gmail.com

unread,
Nov 25, 2018, 3:32:01 AM11/25/18
to grpc.io
hi ,
i have a grpc client program, which reconnects automatically every time there is a server restart. I understand grpc has an in build backoff algorithm that connects automatically.
But i have a use case where when the server disconnection happens  and the when the client connects back to the server i would like to do a replay of messages for the client/server to be in sync.

To do that i need to know everytime the server disconnection happens?
is there a way i could do this ?
I am using grpc golang.
conn, err := grpc.Dial(serverIp+":"+ServerPort, timeout, grpc.WithBlock(), grpc.WithInsecure())

Any help is really appreciated.

Menghan Li

unread,
Nov 28, 2018, 1:57:37 PM11/28/18
to grpc.io
You can set a custom dialer (https://godoc.org/google.golang.org/grpc#WithDialer). This dialer is called to create new connections.

shafat...@gmail.com

unread,
Nov 29, 2018, 8:25:41 AM11/29/18
to grpc.io
Thanks Li, That helped.
Reply all
Reply to author
Forward
0 new messages