primus-spark-heartbeat

    1.0.1 • Public • Published

    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);

    Install

    npm i primus-spark-heartbeat

    DownloadsWeekly Downloads

    5

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.37 kB

    Total Files

    5

    Last publish

    Collaborators

    • carlos870