Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-10-29 07:15:05 +00:00
parent f33dc1e44c
commit f5260050e4
15 changed files with 577 additions and 577 deletions

View File

@@ -4,6 +4,38 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stream/api](ht
Endpoints:
## Publish
Publish a message to the stream. Specify a topic to group messages for a specific topic.
[https://m3o.com/stream/api#Publish](https://m3o.com/stream/api#Publish)
```go
package example
import(
"fmt"
"os"
"github.com/go.m3o.com/stream"
)
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
func PublishAmessage() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.Publish(&stream.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "events",
})
fmt.Println(rsp, err)
}
```
## Subscribe
Subscribe to messages for a given topic.
@@ -31,35 +63,3 @@ func SubscribeToAtopic() {
fmt.Println(rsp, err)
}
```
## Publish
Publish a message to the stream. Specify a topic to group messages for a specific topic.
[https://m3o.com/stream/api#Publish](https://m3o.com/stream/api#Publish)
```go
package example
import(
"fmt"
"os"
"github.com/go.m3o.com/stream"
)
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
func PublishAmessage() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.Publish(&stream.PublishRequest{
Message: map[string]interface{}{
"user": "john",
"id": "1",
"type": "signup",
},
Topic: "events",
})
fmt.Println(rsp, err)
}
```