https://github.com/go-goyave/websocket-example
A minimal chat application to showcase Goyave's websocket features
https://github.com/go-goyave/websocket-example
example-project go golang goyave websocket
Last synced: 5 months ago
JSON representation
A minimal chat application to showcase Goyave's websocket features
- Host: GitHub
- URL: https://github.com/go-goyave/websocket-example
- Owner: go-goyave
- License: mit
- Created: 2021-02-22T12:52:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-07-01T09:38:26.000Z (12 months ago)
- Last Synced: 2025-07-01T10:41:03.306Z (12 months ago)
- Topics: example-project, go, golang, goyave, websocket
- Language: Go
- Homepage: https://goyave.dev
- Size: 244 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Goyave Websocket Example

A minimal chat application to showcase [Goyave](https://github.com/go-goyave/goyave)'s websocket feature. This project is based on [Gorilla's chat example](https://github.com/gorilla/websocket/tree/master/examples/chat).
**Disclaimer:** This example project cannot be used in a real-life scenario, as you would need to be able to serve clients across multiple instances of the application. This is a typical scenario in cloud environments. The hub in this example could use a PUB/SUB mechanism (for example with [redis](https://redis.io/docs/interact/pubsub/)) to solve this issue.
## Getting Started
### Directory structure
```
.
├── http
│ ├── controller
│ │ └── chat // Chat hub implementation
│ └── route
│ └── route.go // Routes definition
│
├── resources
│ └── template // Static resources
│ └── ...
│
├── .gitignore
├── .golangci.yml // Settings for the Golangci-lint linter
├── config.example.json // Example config for local development
├── config.test.json // Config file used for tests
├── go.mod
├── go.sum
└── main.go // Application entrypoint
```
### Running the project
First, make your own configuration for your local environment. You can copy `config.example.json` to `config.json`.
Run `go run main.go` in your project's directory to start the server, then open your browser to `http://localhost:8080`.
## Resources
- [Documentation](https://goyave.dev)
- [go.pkg.dev](https://pkg.go.dev/goyave.dev/goyave/v5)