Skip to content

HerbertGit/Harmony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harmony Server

Description

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 /keys endpoint. It doesn't depend on any specific authorization method in your main server

Requirements

  • Go 1.18 or higher

For running playground example in ./examples/playground

Project Structure

  • 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

Setup

  1. Clone the repository:

    git clone https://github.com/HerbertGit/Harmony
    cd Harmony
  2. Install the dependencies:

    go mod download
  3. 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.

Example usage

For basic usage you can checkout basic React app in ./examples/playground

  1. Go to example folder and install depedencies
cd ./examples/playground
vp i
  1. Run dev server
vp dev

There 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.

References

About

Fast and flexible websocket message brocker, written in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages