https://github.com/szsascha/go-realtime-server
Create a server to handle websocket requests in realtime with go.
https://github.com/szsascha/go-realtime-server
go golang networking realtime websocket
Last synced: 20 days ago
JSON representation
Create a server to handle websocket requests in realtime with go.
- Host: GitHub
- URL: https://github.com/szsascha/go-realtime-server
- Owner: szsascha
- Created: 2023-10-02T11:12:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-02T11:48:00.000Z (over 2 years ago)
- Last Synced: 2025-01-11T18:14:56.472Z (over 1 year ago)
- Topics: go, golang, networking, realtime, websocket
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go realtime server
As part of a larger non-public, private project I needed to create a websocket realtime server in go. The server accepts messages of different types and executes different actions depending on the given message type.
I made the realtime server part of the project modular so I could also use it for other projects. This repository is an extracted result of this modular realtime server.
## Requirements
- Go version >= 1.21.0
## Setup
1. Clone this repo
2. run `go run .` from the main directory of this repo
## Usage
Once the server has started, just send websocket requests to `localhost:8080/ws` with your defined messages.
For example:
```
{
"type": "echo",
"body": "test echo message"
}
```
The implemented messages should be defined in the echo/message/message.go map of MessageTypes with the reference to their struct.
## Functionality
- Handling of websocket connection with connection pooling
- Create own implementation of your realtime processes
- Json serialization of messages
- Implemented echo server as an example
## Disclaimer
This project is not intended to be used in production out-of-the-box.