Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-10-29 12:14:54 +00:00
parent a142615a6b
commit 814f4826d6
14 changed files with 519 additions and 519 deletions

View File

@@ -4,38 +4,6 @@ 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"
"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.
@@ -63,3 +31,35 @@ 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"
"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)
}
```