How to add hook on golang grpc server start?

Viewed 278

Is it possible to add hook just after Serve() method is called?

grpcServer := grpc.NewServer(options)
if err := grpcServer.Serve(newListener("localhost:1234"); err != nil {
    log.Fatalf("failed to serve: %s", err)
}

I need to know when exactly its up and running to be able to call it from tests clients.

1 Answers

I didn't found listener in server side about startup event; And I think there is no sense to listen this event, the right way is to telnet the server address and port in client side for waitting server ready.

Related