diff --git a/client_resolver.go b/client_resolver.go index 0a5cfb1..852749c 100644 --- a/client_resolver.go +++ b/client_resolver.go @@ -17,8 +17,8 @@ import ( // TCPAddress specifies Host and Port for remote broker type TCPAddress struct { - Host string - Port uint16 + Host string `json:"host"` + Port uint16 `json:"port"` } func (t TCPAddress) String() string { return fmt.Sprintf("%s:%d", t.Host, t.Port) } diff --git a/docs/docs/sdk/SDK.md b/docs/docs/sdk/SDK.md index 6a2e24f..cc798d9 100644 --- a/docs/docs/sdk/SDK.md +++ b/docs/docs/sdk/SDK.md @@ -1062,8 +1062,8 @@ TCPAddress specifies Host and Port for remote broker ```go type TCPAddress struct { - Host string - Port uint16 + Host string `json:"host"` + Port uint16 `json:"port"` } ``` diff --git a/http_test.go b/http_test.go index f852c0d..52aca69 100644 --- a/http_test.go +++ b/http_test.go @@ -22,7 +22,7 @@ func TestClient_TelemetryHandler(t *testing.T) { name: "single connection mode", status: http.StatusOK, opts: func(t *testing.T) []ClientOption { return nil }, - body: fmt.Sprintf(`{"clients":[{"addresses":[{"Host":"%s","Port":%d}],"client_id":"clientID","username":"","resume_subs":false,"clean_session":false,"auto_reconnect":true,"connected":true}],"multi":false} + body: fmt.Sprintf(`{"clients":[{"addresses":[{"host":"%s","port":%d}],"client_id":"clientID","username":"","resume_subs":false,"clean_session":false,"auto_reconnect":true,"connected":true}],"multi":false} `, testBrokerAddress.Host, testBrokerAddress.Port), }, { @@ -50,7 +50,7 @@ func TestClient_TelemetryHandler(t *testing.T) { UseMultiConnectionMode, } }, - body: fmt.Sprintf(`{"clients":[{"addresses":[{"Host":"%s","Port":%d}],"client_id":"clientID-0-1","username":"","resume_subs":false,"clean_session":false,"auto_reconnect":true,"connected":true},{"addresses":[{"Host":"%s","Port":%d}],"client_id":"clientID-1-1","username":"","resume_subs":false,"clean_session":false,"auto_reconnect":true,"connected":true}],"multi":true} + body: fmt.Sprintf(`{"clients":[{"addresses":[{"host":"%s","port":%d}],"client_id":"clientID-0-1","username":"","resume_subs":false,"clean_session":false,"auto_reconnect":true,"connected":true},{"addresses":[{"Host":"%s","Port":%d}],"client_id":"clientID-1-1","username":"","resume_subs":false,"clean_session":false,"auto_reconnect":true,"connected":true}],"multi":true} `, testBrokerAddress.Host, testBrokerAddress.Port, testBrokerAddress.Host, testBrokerAddress.Port), }, }