onyx-40-loc-distributed-chat

Built with Crystal Travis CI build

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

  1. Install Crystal. See the installation instructions.

  2. Clone the repository:

> git clone https://github.com/vladfaust/onyx-40-loc-distributed-chat && \
cd onyx-40-loc-distributed-chat
  1. Install dependenies:
> shards install
  1. Run the server:
> env REDIS_URL=<YOUR_REDIS_5_URL> PORT=5000 crystal src/server.cr
  1. Test the server with wscat:
> wscat --connect localhost:5000?username=Alice
> Hi
< Alice: Hi
>
  1. Repeat steps 3 and 4 with another PORT to see the distribution in action.

Contributors

Licensing

This software is licensed under MIT License.

Open Source Initiative

Github statistic:
  • 2
  • 0
  • 1
  • 0
  • 6 days ago

License:

MIT License

Links: