npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chat21/chat21-server

v0.2.53

Published

Chat21 AMQP/MQTT messages dispatcher

Downloads

119

Readme

Chat21 Real Time messaging engine

🚀 Do you want to install Tiledesk on your server with just one click?

Use Docker Compose Tiledesk installation guide

Chat21 Real Time messaging engine is a simple "observer" on RabbitMQ Message Brocker.

Chat21 Client Applications use MQTT protocol to connect to RabbitMQ. Each end-user writes outoging messages on a specific path where his RabbitMQ JWT Token allows him to write.

MQTT Outgoing path example:

/apps/tilechat/users/USER-ID/RECIPIENT-USER-ID/messages/outgoing

The Client application connected with MQTT to RabbitMQ, sends the message as a JSON payload to the /outgoing path.

The observer subscribes himself to these paths. As soon as he gets notified of an outgoing message the same message payload is forwarded (AMQP publish operation) to the recipient path:

/apps/tilechat/users/RECIPIENT-USER-ID/SENDER-USER-ID/messages/clientadded

The recipient will receive the MQTT publish notification on the incoming path decoding it as a new message based on the final part of the path, that always indicates the type of operation on that path:

/clientadded = new payload (a message) arrived on the path.

Using this observer Chat21 implements the "inbox" concept. Messages are not delivered directly with shared path between the two clients, but rather delivered through this observer who can take additional actions to improve privacy, security, persistence and apply other policies on messages (i.e. blocking users).

Moreover, a granular security can be applied with the "inbox" pattern, using RabbitMQ JWT Tokens specification, where a user can only read and write on his own, specific paths, never reading or writing directly on other users inboxes.

The inbox pattern just works like email SMTP/POP3 protocols. The message is sent from the user to his own SMTP server inbox (the /outgoing path), as an outgoing message. The "observer" (this application), gets the message and sends it to the recipient's SMTP server (the recipient inbox path) with a /clientadded action where the recipient itself will receive the message as soon as he connects to RabbitMQ through MQTT.

Docker Build

docker build -t chat21/chat21-server:dev .

docker push chat21/chat21-server:dev

docker run chat21/chat21-server:dev

Benchmarks

On local project folder run:

./benchmarks.sh

With the following settings:

EXPECTED_AVG_DIRECT_MESSAGE_DELAY: 160, EXPECTED_AVG_GROUP_MESSAGE_DELAY: 160, REQS_PER_SECOND: 50, MAX_SECONDS: 10, CONCURRENCY: 1, // 2

The benchmark must pass to get good results, getting somthing like this:

Performance Test
chatClient1 Connected...
chatClient2 Connected...
TOTAL GROUP CREATION TIME 36ms


*********************************************
********* Direct messages benchmark *********
*********************************************


Direct - Expected message average latency to be < 160ms
Direct - Expected MESSAGES/SEC = 60
Direct - Expected MESSAGES/SEC/VU = 60
Direct - Expected TEST DURATION (s) = 10
Direct - Expected CONCURRENCY (#VUs) = 1
Direct - Expected DELAY BETWEEN MESSAGES (ms) = 16.666666666666668
Direct - Expected TOTAL ITERATIONS = 600
Direct - Running benchmark...


********* Direct - Benchmark results *********
Direct - Message mean latency: 13.851666666666667
Direct - Test duration: 10 seconds (10441) ms
Direct - MESSAGES/SEC: 60
Direct messages benchmark performed good! 😎
'Direct' benchmark end.
    ✔ Benchmark for direct messages (10452ms)


********************************************
********* Group messages benchmark *********
********************************************


Group - Expected message average latency to be < 160ms
Group - Expected CONCURRENCY (#VIRTUAL USERs aka VUs) = 1
Group - Expected MESSAGES/SEC = 60
Group - Expected MESSAGES/SEC/VU = 60
Group - Expected TEST DURATION (s) = 10
Group - Expected DELAY BETWEEN MESSAGES (ms) = 16.666666666666668
Group - Expected TOTAL ITERATIONS = 600
Group - Running benchmark...
End 'Direct' benchmark iterations.


********* Group - Benchmark results *********
Group - Final latency: 45.611666666666665
Group - Expected max average latency: 160
Group - Test duration: 10 seconds (10456) ms
Group - MESSAGES/SEC: 60
Group messages benchmark performed good! 😎
'Group' benchmark end.
    ✔ Benchmark for group messages (10523ms)


  2 passing (21s)