This repository has been archived by the owner. It is now read-only.
websockets for reddit
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfile Add service quiescing and connection shedding. Feb 27, 2017
LICENSE Add license and readme Apr 8, 2016
Vagrantfile Add Vagrant dev environment setup from cookiecutter May 28, 2017
example.ini Connect to correct rabbitmq hostname. Mar 5, 2018


Websockets for reddit.

This service is primarily aimed at broadcasting messages to clients. It can also optionally report to the backend when clients connect or disconnect. All communication with other backend services is mediated by an AMQP broker (RabbitMQ).


Applications using this service are in charge of managing authorization. The service validates that incoming requests were authorized by the main application using a message authentication code. The path portion of a websocket request indicates which message "namespace" the socket will receive.

Messages are sent to the service via an AMQP fan out exchange. Each worker process binds to the exchange and will receive all messages sent to it. Messages are dispatched to appropriate websocket clients by mapping the message's routing key to the socket namespace specified in the websocket request.

If configured to do so, the service will also insert connect/disconnect messages onto a topic exchange in AMQP.

Testing and Development

There are two Docker images provided for development and testing.

  • Dockerfile: A Docker image definition for running a local version of the service.
  • Dockerfile.test: A Docker image definition for running tests.
# Exposes websocket service at
docker build . -t ws-server -f Dockerfile  && docker run --rm -p 9090:9090 ws-server

# Run code tests
docker build . -t ws-tests -f Dockerfile.test  && docker run ws-tests

Further reading

This service is used and written for's socket needs. Client and server code examples can be found in the monolith's repos: