Skip to content

Set up redis based event bus

This document describes how to set up an event bus with Redis, for Wagtail Live publishers.

An event bus provides an abstraction over the Publish/Subscribe pattern.

The goal of the event bus in Wagtail Live is the following:

  • Publisher: A live page sends a new message containing its recent modifications to its channel group. Each live page is associated to a unique channel group.

  • Subscriber: The users viewing a page in live subscribe to that page's channel group and receive the page modifications as soon as possible.

Redis provides PubSub commands. We will then need to install redis and aioredis. The latter provides asyncio Redis support.

Install redis

Follow the steps outlined here to install Redis.

Whenever you want to test your application, you will have to start the Redis server.

If you have docker installed, you can run this command:

docker run -p 6379:6379 -d redis:5

Install aioredis

To install aioredis, type:

$ pip install aioredis