You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple demo of Redis Streams backed Chat app using Websockets, Python Asyncio and FastAPI/Starlette.
3
3
4
-
Requires Python version >= 3.6 and Redis
4
+
Requires Python version >= 3.11 and Redis 7+
5
5
6
6
# Overview
7
7
This project has been created to help understand some related concepts. Python standard library asyncio, websockets (which are often cited as a classic use case for async python code), also Redis Streams. It is very much inteded to be an intentionally simple starting point rather than a usable product as is.
8
8
9
9
# Installation
10
10
11
+
## Local Development
12
+
11
13
```shell
12
14
$ pip install -r requirements.txt
13
15
```
14
16
17
+
Make sure you have Redis running locally:
18
+
```shell
19
+
$ redis-server
20
+
```
21
+
15
22
# Usage
16
23
24
+
## Local Development
25
+
17
26
```shell
18
27
$ python chat.py
19
28
```
20
29
21
-
# Docker compose
22
-
If you don't have redis installed you can use the docker-compose.yml file to set up a
23
-
working environment.
30
+
Then open http://localhost:9080 in your browser.
31
+
32
+
## Docker Compose
33
+
34
+
The easiest way to run the application with all dependencies:
35
+
36
+
```shell
37
+
$ docker-compose up
38
+
```
39
+
40
+
This will start both the chat application and Redis in containers. The app will be available at http://localhost:9080
41
+
42
+
## Environment Variables
43
+
44
+
The following environment variables can be configured:
45
+
46
+
-`REDIS_HOST` - Redis server hostname (default: `localhost`, set to `redis` in Docker)
47
+
-`REDIS_PORT` - Redis server port (default: `6379`)
0 commit comments