This repository contains code from the Distributed websocket chat in 40 lines of code blog post. It is powered by Crystal, Onyx Framework and Redis.
-
Install Crystal. See the installation instructions.
-
Clone the repository:
> git clone https://github.com/vladfaust/onyx-40-loc-distributed-chat && \
cd onyx-40-loc-distributed-chat- Install dependenies:
> shards install- Run the server:
> env REDIS_URL=<YOUR_REDIS_5_URL> PORT=5000 crystal src/server.cr- Test the server with wscat:
> wscat --connect localhost:5000?username=Alice
> Hi
< Alice: Hi
>- Repeat steps 3 and 4 with another
PORTto see the distribution in action.
- Vlad Faust - creator and maintainer
This software is licensed under MIT License.