Skip to content

Commit

Permalink
update: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhnajafiz committed Aug 10, 2022
1 parent 6bf9fce commit 9b39255
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
# Stallion
<h1 align="center">
Stallion
</h1>

Message broker with Golang.

## How to use?
Get package:
```shell
go get github.com/amirhnajafiz/stallion
```

### Client
```go
package main

import (
"fmt"
"time"

"github.com/amirhnajafiz/stallion"
)

func main() {
client, err := stallion.NewClient("localhost:9090")
if err != nil {
panic(err)
}

client.Subscribe("topic", func(data []byte) {
fmt.Println(string(data))
})

client.Publish("topic", []byte("Hello"))

time.Sleep(3 * time.Second)
}
```

### Server
```go
package main

import "github.com/amirhnajafiz/stallion"

func main() {
if err := stallion.NewServer(":9090"); err != nil {
panic(err)
}
}
```

0 comments on commit 9b39255

Please sign in to comment.