Skip to content

Commit

Permalink
Add Ping method and refactor import paths in client.go
Browse files Browse the repository at this point in the history
The client.go file has been modified to include a new Ping method. This addition allows the server's status to be checked. Also, the import paths of the grpc library and other dependencies have been updated to reflect changes in their locations.
  • Loading branch information
liornabat committed Jan 30, 2024
1 parent 04b383d commit 7f95631
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"
"github.com/kubemq-io/kubemq-go/v2/config"
"github.com/kubemq-io/kubemq-go/v2/grpc"
"github.com/kubemq-io/kubemq-go/v2/pubsub/events"
"github.com/kubemq-io/kubemq-go/v2/pubsub/events_store"
"github.com/kubemq-io/kubemq-go/v2/pubsub/grpc"
"time"
)

Expand Down Expand Up @@ -117,6 +117,13 @@ func (c *Client) SubscribeToEventsStore(ctx context.Context, subscription *event
return nil
}

func (c *Client) Ping(ctx context.Context) (*grpc.ServerInfo, error) {
if c.clientCtx.Err() != nil {
return nil, fmt.Errorf("client is closed")
}
return c.transport.Ping(ctx)
}

func (c *Client) Close() error {
c.clientCancelFunc()
return c.transport.Close()
Expand Down

0 comments on commit 7f95631

Please sign in to comment.