reddit/reddit-service-websockets

Name: reddit-service-websockets

Owner: Reddit

Description: websockets for reddit

Created: 2016-01-26 08:10:40.0

Updated: 2018-05-14 22:13:31.0

Pushed: 2018-03-05 17:27:34.0

Homepage:

Size: 45

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

reddit-service-websockets

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

Usage

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.

poses websocket service at 127.0.0.1:9090
er build . -t ws-server -f Dockerfile  && docker run --rm -p 9090:9090 ws-server

n code tests
er build . -t ws-tests -f Dockerfile.test  && docker run ws-tests
Further reading

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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.