goddit

command module
v0.0.0-...-d7094f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2020 License: MIT Imports: 16 Imported by: 0

README

Golang chat server 🏓

============================

Try it out!
  • Install mongodb
  • Clone repo to $GOPATH/src/github.com/octohedron/goddit
  • Install dependencies
$ go get
  • Build the binary
$ go build
  • Edit the .env file in the root of the repository with your values
# from reddit.com/prefs/apps
APPID=YOUR_APP_ID
APPSECRET=YOUR_APP_SECRET
GODDITADDR=YOUR_SERVER_ADDR # i.e. http://localhost:9000
GODDITDOMAIN=YOUR_DOMAIN # i.e. localhost / goddit.pro
GPORT=9000 # 9000 / 80
GCOOKIE=YOUR_COOKIE # i.e. goddit
MONGO_ADDR=YOUR_MONGO_ADDR # i.e. 127.0.0.1, 172.17.0.1 for docker, etc
MONGO_USER=YOUR_MONGO_USER # i.e. username
MONGO_PASS=YOUR_MONGO_PASS # i.e. hunter2
  • Run it manually
$ nohup ./goddit &
  • Run it with Docker
docker rm goddit && docker build -t goddit . && docker run --name goddit -p 9000:9000 -it goddit

Features

  • Crawls popular subreddits (first 25) and adds them as chatrooms in a separate goroutine (for faster startup) when you start the program
  • Loads previous chatroom history (up to 150 messages) when switching rooms
  • Authorizes via reddit and pairs a cookie with a user in the server for Authorization
  • Only broadcasts messages to those present in the room, not to others in different rooms
  • Different color avatars, autogenerated from placeskull.com
  • Enforces a single WebSocket for each client, closing the connection when switching rooms
  • Each client reads and writes to a different goroutine (2 goroutines/client)
  • Database writes are performed in a separate goroutine
CONTRIBUTING: Yes

LICENSE: MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL