https://github.com/gaurishhs/vox
Simple, Lightweight pub/sub library in Golang
https://github.com/gaurishhs/vox
Last synced: 3 months ago
JSON representation
Simple, Lightweight pub/sub library in Golang
- Host: GitHub
- URL: https://github.com/gaurishhs/vox
- Owner: gaurishhs
- License: mit
- Created: 2023-03-10T05:49:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-10T17:26:32.000Z (about 2 years ago)
- Last Synced: 2025-01-22T09:12:05.838Z (4 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vox
[](https://pkg.go.dev/github.com/gaurishhs/vox)
[](https://goreportcard.com/report/github.com/gaurishhs/vox)Simple pub/sub library for Golang
## Installation
```bash
go get -u github.com/gaurishhs/vox
```## Usage
```go
package mainimport (
"fmt""github.com/gaurishhs/vox"
)func main() {
// Create a new publisher
pub := vox.NewPublisher()
sub := vox.NewSubscriber()// Subscribe to a topic
sub.Subscribe("topic")
// Publish a message to a topic
pub.Publish("topic", "Hello World")sub.Listen(func(message *vox.Message) {
fmt.Println(topic, message)
})
}
```## License
This project is licensed under MIT License - see the
LICENSE file for details