Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jdecool/go-mercure

Go client library for publishing an event through Mercure protocol
https://github.com/jdecool/go-mercure

Last synced: about 2 months ago
JSON representation

Go client library for publishing an event through Mercure protocol

Awesome Lists containing this project

README

        

go-mercure
==========

go-mercure is a Go client library for [Mercure](https://mercure.rocks).

## Usage

```go
import "github.com/jdecool/go-mercure/mercure"
```

### Publish an event

```go
u, _ := url.Parse("https://localhost:3000/.well-known/mercure")
jwt := "my-jwt"

m := mercure.Message{
Topics: []string{
"http://localhost/test",
},
Data: []byte("Hello World"),
}

p := mercure.NewPublisher(u, jwt, nil)
evtId, err := p.Publish(m)
```