Files
m3o-go/examples/stream/publish/publishAMessage/main.go
2021-11-03 11:49:43 +00:00

23 lines
440 B
Go
Executable File

package main
import (
"fmt"
"os"
"go.m3o.com/stream"
)
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
func main() {
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)
}