websocket-example

command module
v0.0.0-...-36cb4d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 8 Imported by: 0

README

Goyave Logo Goyave Logo

Goyave Websocket Example

A minimal chat application to showcase Goyave's websocket feature. This project is based on Gorilla's chat example.

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) 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

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
http

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL