Harmony is a fast, flexible WebSocket message broker designed to work with existing infrastructure.
Key characteristics:
- Fast - sub-1ms response time for WebSocket messages
- Flexible - no predefined data structure; messages are defined using "Contracts" based on JSON Schema
- No storage - Harmony doesn't store messages by default, so your main server retains full control over all data
- Verification based on JWT - Harmony authorizes users using a JWT token signed with an asymmetric key generated through the
/keysendpoint. It doesn't depend on any specific authorization method in your main server
- Go 1.18 or higher
For running playground example in ./examples/playground
- [Node]
- Vite+
main.go: The main application entry point../internal/api: Handler for all REST endpoint and WebSocket, each group has it's own file<GROUP>.go./internal/data: Main logic of Harmony server
-
Clone the repository:
git clone https://github.com/HerbertGit/Harmony cd Harmony -
Install the dependencies:
go mod download
-
Run the application:
go run .
The application should now be running on http://localhost:8080.
During startup Harmony generates pair of first private key and keyId used for signing JWT tokens.
For basic usage you can checkout basic React app in ./examples/playground
- Go to example folder and install depedencies
cd ./examples/playground
vp i- Run dev server
vp devThere should a server running in at http://localhsot:5173
Paste private key and keyId displayed in console during server startup and any username.
This example create chat room after sign in with all users registered before. This means you can open two browser tabs, sign in with two diffrent usernames and start sending messages between them. After signing in the second browser, make sure to click "Reload" in the first one to see chat room created in other one.