Skip to content
Self hosted live chat server written in Go
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/goch Update dependencies Jul 11, 2019
internal Simplify Test for listing members Jul 11, 2019
pkg Complete limits tests Mar 4, 2019
.env Update dependencies Jul 11, 2019
.gitignore Update dependencies Jul 11, 2019
.travis.yml Update go version in travis Jul 10, 2019
LICENSE Addconfig tests Mar 4, 2019 Make routes clearer to read in Readme Jul 12, 2019
chat.go Finish tests Jul 10, 2019
chat_test.go Add tests Jul 10, 2019
docker-compose.yml Various updates Mar 18, 2019
go.mod Remove vendor folder Jul 11, 2019
go.sum Remove vendor folder Jul 11, 2019
limit.go Addconfig tests Mar 4, 2019
message.go Init push Mar 3, 2019
message_test.go Add tests Jul 10, 2019 Update permissions Jul 10, 2019
up Init push Mar 3, 2019
user.go Init push Mar 3, 2019


Build Status codecov Go Report Card Maintainability

goch is a self-hosted live-chat server written in Go.

It allows you to run a live-chat software on your own infrastructure.

You can create multiple private and public chatrooms where two or more users can be at the same time.

For communication, it uses RESTful endpoints, Websockets, NATS Streaming, and Redis.

Goch is a fork of Gossip, with many added features and fixes.

Getting started

To run goch locally, you need docker, docker-compose and go installed and set on your path. After downloading/cloning the project, run ./up which compiles the binary and runs docker-compose with goch, NATS Streaming, and Redis. If there were no errors, goch should be running on localhost (port 8080).

How it works

In order for the server to run, ADMIN_USERNAME and ADMIN_PASSWORD env variables have to be set. In the repository, they are set to admin and pass respectively, but you should obviously change those for security reasons.

Once the server is running, the following routes are available:

  • POST /admin/channels: Creates a new channel. You have to provide a unique name for a channel (usually an ID), and the response includes channel's secret which will be used for connecting to channel later on. This endpoint should be invoked server-side with provided admin credentials. The response should be saved in order to connect to the channel later on.

  • POST /register: Register a user in a channel. In order to register for the channel, a UID, DisplayName, ChannelSecret, and ChannelName needs to be provided. Optionally user secret needs to be provided, but if not the server will generate and return one.

  • GET /connect: Connects to a chat and returns a WebSocket connection, along with chat history. Channel, UID, and Secret need to be provided. Optionally LastSeq is provided which will return chat history only after LastSeq (UNIX timestamp).

The remaining routes are only used as 'helpers':

  • GET /channels/{name}?secret=$SECRET: Returns list of members in a channel. Channel name has to be provided as URL param and channel secret as a query param.

  • GET /admin/channels: Returns list of all available channels.

  • GET /admin/channels/{name}/user/{uid}: Returns list of unread messages on a chat for a user.


goch is licensed under the MIT license. Check the LICENSE file for details.


Emir Ribic

You can’t perform that action at this time.