Skip to content

Commit

Permalink
rename handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ajatprabha committed Jan 22, 2024
1 parent 5964b5a commit 0456a90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions docs/docs/sdk/SDK.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Package courier contains the client that can be used to interact with the courie
- [func WaitForConnection\(c ConnectionInformer, waitFor time.Duration, tick time.Duration\) bool](#WaitForConnection)
- [type Client](#Client)
- [func NewClient\(opts ...ClientOption\) \(\*Client, error\)](#NewClient)
- [func \(c \*Client\) InfoHandler\(\) http.Handler](#Client.InfoHandler)
- [func \(c \*Client\) IsConnected\(\) bool](#Client.IsConnected)
- [func \(c \*Client\) Publish\(ctx context.Context, topic string, message interface\{\}, opts ...Option\) error](#Client.Publish)
- [func \(c \*Client\) Run\(ctx context.Context\) error](#Client.Run)
- [func \(c \*Client\) Start\(\) error](#Client.Start)
- [func \(c \*Client\) Stop\(\)](#Client.Stop)
- [func \(c \*Client\) Subscribe\(ctx context.Context, topic string, callback MessageHandler, opts ...Option\) error](#Client.Subscribe)
- [func \(c \*Client\) SubscribeMultiple\(ctx context.Context, topicsWithQos map\[string\]QOSLevel, callback MessageHandler\) error](#Client.SubscribeMultiple)
- [func \(c \*Client\) TelemetryHandler\(\) http.Handler](#Client.TelemetryHandler)
- [func \(c \*Client\) Unsubscribe\(ctx context.Context, topics ...string\) error](#Client.Unsubscribe)
- [func \(c \*Client\) UsePublisherMiddleware\(mwf ...PublisherMiddlewareFunc\)](#Client.UsePublisherMiddleware)
- [func \(c \*Client\) UseSubscriberMiddleware\(mwf ...SubscriberMiddlewareFunc\)](#Client.UseSubscriberMiddleware)
Expand Down Expand Up @@ -237,6 +237,15 @@ c.Stop()
</p>
</details>

<a name="Client.InfoHandler"></a>
### func \(\*Client\) [InfoHandler](https://github.com/gojek/courier-go/blob/main/http.go#L9)

```go
func (c *Client) InfoHandler() http.Handler
```

InfoHandler returns a http.Handler that exposes the connected clients information

<a name="Client.IsConnected"></a>
### func \(\*Client\) [IsConnected](https://github.com/gojek/courier-go/blob/main/client.go#L84)

Expand Down Expand Up @@ -300,15 +309,6 @@ func (c *Client) SubscribeMultiple(ctx context.Context, topicsWithQos map[string

SubscribeMultiple allows to subscribe to messages on multiple topics from an MQTT broker

<a name="Client.TelemetryHandler"></a>
### func \(\*Client\) [TelemetryHandler](https://github.com/gojek/courier-go/blob/main/http.go#L9)

```go
func (c *Client) TelemetryHandler() http.Handler
```

TelemetryHandler returns a http.Handler that exposes the connected clients information

<a name="Client.Unsubscribe"></a>
### func \(\*Client\) [Unsubscribe](https://github.com/gojek/courier-go/blob/main/client_unsubscribe.go#L10)

Expand Down
4 changes: 2 additions & 2 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http"
)

// TelemetryHandler returns a http.Handler that exposes the connected clients information
func (c *Client) TelemetryHandler() http.Handler {
// InfoHandler returns a http.Handler that exposes the connected clients information
func (c *Client) InfoHandler() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
cl := c.allClientInfo()

Expand Down
2 changes: 1 addition & 1 deletion http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestClient_TelemetryHandler(t *testing.T) {
_ = c.Run(ctx)
}()

h := c.TelemetryHandler()
h := c.InfoHandler()

assert.True(t, WaitForConnection(c, 2*time.Second, 100*time.Millisecond))

Expand Down

0 comments on commit 0456a90

Please sign in to comment.