Update README.md

This commit is contained in:
Asim Aslam
2021-04-21 16:06:06 +01:00
committed by GitHub
parent 8bfd7992ad
commit 6d6edbe311

View File

@@ -43,18 +43,6 @@ func main() {
} }
``` ```
If you want to access your local micro:
```go
c := client.NewClient(client.Options{Local: true})
```
You can also set the api address explicitly:
```go
c := client.NewClient(client.Options{Address: "https://api.yourdomain.com"})
```
## Streaming ## Streaming
The client supports streaming The client supports streaming
@@ -76,9 +64,16 @@ type Response struct {
Count string `json:"count"` Count string `json:"count"`
} }
func main() { var (
c := client.NewClient(&client.Options{Local: true}) token, _ = os.Getenv("TOKEN")
)
func main() {
c := client.NewClient(nil)
// set your api token
c.SetToken(token)
stream, err := c.Stream("streams", "subscribe", Request{Count: "10"}) stream, err := c.Stream("streams", "subscribe", Request{Count: "10"})
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)