Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-10-29 08:12:32 +00:00
parent c2ee05e2eb
commit 1682d4075e
15 changed files with 677 additions and 677 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"
"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.
@@ -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"
"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{}{
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "events",
})
fmt.Println(rsp, err)
}
```

View File

@@ -12,9 +12,9 @@ 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",
"id": "1",
},
Topic: "events",
})