Broadcast server sent events by sending HTTP calls.
- Event Go
- Table of contents
- Features
- Docker deployment
- Installation
- Build and run
- Configuration
- Endpoints
- Contributing
- License
- Community and Support
- Broadcast events: Server sent events are broadcasted once an authorized user sends an HTTP call.
- Event storage: New clients immediately receive the latest events once they connect.
- Dockerized Deployment: Simple setup with Docker and Docker Compose.
- Production and Debug Modes: Easily switch between production and debug builds.
To pull the image from the Docker registry and run it locally using compose.sample.yaml
docker compose --file compose.sample.yaml up -d
Alternatively, to build and run the local Dockerfile
(useful for debugging purposes)
docker compose --file compose.dev.yaml up -d
- Docker: install Docker
- Docker Compose: Install Docker Compose
git clone https://github.com/heissonwillen/event-go.git
cd event-go
To download the dependencies, and have the hot-reloading locally
go mod tidy && air
Alternatively, it's possible to run without hot-reloading (air
)
go mod tidy && go run -v cmd/server/main.go
go test ./... -v
Variable | Description | Default Value |
---|---|---|
LISTEN_ADDR |
API listen address | :8080 |
SQLITE_DB_PATH |
SQLite DB path | tmp/event-go.sqlite |
BASIC_AUTH_USER |
Username for /authorized endpoints |
admin |
BASIC_AUTH_PASSWORD |
Password for /authorized endpoints |
pass |
Method | Endpoint | Description |
---|---|---|
POST |
/authorized/events |
Broadcast a new event to all clients. The event is stored on the DB as a side-effect. It uses basic-auth - see environment variables section. |
GET |
/events |
Receive stream of events. The latest event from the DB is broadcasted when a new client connects. |
- Fork the repository.
- Create a new branch:
git checkout -b my-feature-branch
- Make your changes and add tests.
- Submit a pull request.
event-go is licensed under the MIT License.
- Issues: GitHub issues
- Discussions: GitHub discussions