Skip to content

carlos870/primus-spark-heartbeat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

primus-spark-heartbeat

primus-spark-heartbeat is a Primus plugin used to change how the heartbeat system works. The current version of Primus uses only one cycle on the server to broadcast all ping messages to the connected clients.

In some scenarions, like having hundreds/thousands of connected clients and/or having event listeners attached to the spark heartbeat event, you may prefer to not have all heartbeats starting exactly at the same time.

This plugin runs an individual cycle for each connected client, always starting when each connection is up, and not when the Primus server did start. If you disable the heartbeat mechanism, the plugin will detect that and have no effect.

Installation

npm install primus-spark-heartbeat

Usage

const Primus = require('primus');
const SparkHeartbeat = require('primus-spark-heartbeat');

const primusServer = new Primus(/*http server*/);
primusServer.plugin('spark-heartbeat', SparkHeartbeat);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published