onyx-40-loc-distributed-chat
Version, currently master branch1 version
- master branchlatestAug 13, 2019
github.com/vladfaust/onyx-40-loc-distributed-chat
A 40-LoC example of a distributed websocket chat build with [Onyx Framework](https://onyxframework.org). Read the blogpost at https://blog.onyxframework.org/posts/distributed-websocket-chat-in-40-loc
Installation
# Add this to your shard.yml
dependencies:
onyx-40-loc-distributed-chat:
github: vladfaust/onyx-40-loc-distributed-chat
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.30.1- License
- MIT
- Author
- Vlad Faust
- Target
serverfrom src/server.cr
Dependencies
Runtime Dependencies
README
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.
⚠️ NOTE: The application requires Redis version >= 5!
Installation
-
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.
Contributors
- Vlad Faust - creator and maintainer
Licensing
This software is licensed under MIT License.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Aug 13, 2019
- Crystal
0.30.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/vladfaust/onyx-40-loc-distributed-chat
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1