Skip to content
/ gossip Public

Gossip is a simple scalable messaging service written in Go

Notifications You must be signed in to change notification settings

dkvilo/gossip

Repository files navigation

Gossip

Gossip is a WebSocket based Messaging Service written in Golang, Gossip uses the advantage of concurrency, also it is built on the namespace based messaging architecture.

  • Client Limit per Room: 256 (configurable)
  • Maximum Message Size: 1024 (configurable)

Start

  $ cp env.example .env
  $ docker-compose up --build

Example App

Preview Screenshot 2 Preview Screenshot 1

Web Client Example

// HMAC Token - Available in terminal
const accessToken = "..."

// Room Should be provided by user
const room = "random"

/*
* Make sure that http://localhost:3000 is listed in your .env file as a ALLOWED_ORIGINS
* ALLOWED_ORIGINS=http://localhost:3000,http://localhost:4000 
*/
const ws = new WebSocket(`http://localhost:3000/ws?room=${room}&accessToken=$${accessToken}`);

ws.addEventListener("open", () => {
  console.log("New Client Connected")
  ws.Send("Hello, World")
})

ws.addEventListener("message", (package) => {
  let messages = package.data.split("\n");
  console.log("Messages", messages)
})

Todo

  • Read/Write messages from redis
  • Dump messages from redis to MongoDB after some time
  • Add Message (Package) validation
  • Generate Room/Namespace from server
  • Create Better Example app using React

Author: David Kviloria

About

Gossip is a simple scalable messaging service written in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published