mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-23 23:21:27 +00:00
Update README.md
This commit is contained in:
21
README.md
21
README.md
@@ -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,8 +64,15 @@ type Response struct {
|
|||||||
Count string `json:"count"`
|
Count string `json:"count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
token, _ = os.Getenv("TOKEN")
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
c := client.NewClient(&client.Options{Local: true})
|
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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user