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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ekko-realtime-client

v2.3.2

Published

JavaScript client to interact with realtime ekko-server

Downloads

5

Readme

Ekko client

A JavaScript client for Ekko, the realtime serverless platform.

If you have not already done so, you should first deploy your Ekko infrastructure using the Ekko CLI https://github.com/ekko-realtime/cli

Download ekko-client

Download Ekko client from any of the following sources:

Use the CDN

<script src="https://d3irfuxwybyrt2.cloudfront.net/ekko-client-v2.2.6.js"></script>

Use a package manager

npm install ekko-realtime-client

Get the source code

https://github.com/ekko-realtime/client

Initialization

Description

Use this method to initialize the Ekko client. At a minimum you will need to provide the host endpoint and a valid JWT which can be generated with the Ekko CLI

Method

Ekko( {String host, String JWT, String AppName, String UUID} )

| Parameter | Type | Required | Defaults | Description | | :-------- | :----- | :------- | :---------------------- | :-------------------------------------------------------------------------------------------------------------------------- | | host | String | Yes | | URL endpoint for your Ekko server provided by your Ekko CLI | | JWT | String | Yes | | App specific JWT for authenticating your Ekko client instance provided by your Ekko CLI | | AppName | String | Yes | | Name of the application you are working on. Used for message routing | | UUID | String | Optional | Randomly generated UUID | Unique identifier for each user. Useful for maintaining user state across devices |

Note: https://www.npmjs.com/package/lil-uuid is an NPM package that can be used to generate UUID's

Basic Usage

Applications can initialize the Ekko client object by passing the host and JWT provided by your Ekko CLI. Each client will also need the appName that was used to generate the JWT. Each client should also pass a UUID that represents the user or the device that connects to th Ekko server.

const ekko = new Ekko({
  host: "myEkkoServerEndpoint",
  jwt: "myAppJWT",
  appName: "myAppName",
  uuid: "myUniqueUUID",
});

Event Listeners

Description

You can add callback functions to status, message, and presence events using the addListener method.

Adding Listeners

ekko.addListener({
  status: (ekkoEvent) => {
    const event = ekkeEvent.event // Description of the event that occurred
    const app = ekkoEvent.app; // App that the event occurred on
    const admin = ekkoEvent.admin; // True if user that triggered event is an Admin, False otherwise
  },
  message: (ekkoEvent) => {
    const message = ekkoEvent.message; // Message object
    const channel = ekkoEvent.channel; // Channel on which the message was published
    const uuid = ekkoEvent.uuid; // Message publisher
  },
  presence: (ekkoEvent) => {
    // TODO: FILL OUT
  },
});

Listener Status Events

TODO: FILL OUT

Listener Presence Event

TODO: FILL OUT

Publish

Description

The publish() method is used to send a message to all subscribers of a channel within the same app as teh publisher.

Publish Anytime

The publisher can only publish to other users within the same app, but they do not necessarily need to be a subscriber to the channel they are publishing to.

Message Data

The message argument can be any valid JavaScript object. You are able to define any properties you need to meet your app's requirements.

Method

publish(Object message, String channel)

| Parameter | Type | Required | Defaults | Description | | :-------- | :----- | :------- | :------- | :------------------------------------------------ | | message | Object | Yes | | The message may be any valid JavaScript object. | | channel | String | Yes | | Specifies channel name to publish messages to. |

Basic Usage

ekko.publish({
  channel: "my_channel",
  message: {
    text: "my message text",
    otherProperty: "any other data you need to pass to subscribers",
  },
});

Subscribe

Description

This method causes the client to create an open TCP socket connection to the Ekko server and begin listening for messages on a specific channel.

Method

subscribe({Array channels, Boolean withPresence})

| Parameter | Type | Required | Defaults | Description | | :------------- | :------ | :------- | :------- | :-------------------------------------------------------------------------------------------------- | | channels | Array | Yes | | Specifies the channels to subscribe to. It is possible to specify multiple channels as an array | | withPresence | Boolean | Optional | False | If true it also subscribes to presence events |

Basic Usage

Subscribe to single channel

ekko.subscribe({
  channels: ["my_channel"],
});

Subscribe to multiple channels

ekko.subscribe({
  channels: ["my_channel_1", "my_channel_2", "my_channel_3"],
});

Subscribe with presence

ekko.subscribe({
  channels: ["my_channel"],
  withPresence: true,
});

Accessing Ekko client information

Description

Ekko client information is stored on the ekko instance and can be accessed.

Host

ekko.host // Ekko server host endpoint URL

uuid

ekko.uuid // Ekko client instance uuid

Host

ekko.appName // Ekko app name

Open Source Development

Update Distribution File

Description

Ekko is an open source project - modification and further development is encouraged!

The distribution files within the /dist directory are useful when developing front-end only applications. This file contains all of the necessary dependencies to run Ekko client. These are the files that are uploaded to the Ekko CDN.

Changes to the Ekko client code should be made within /lib/ekko.js. If you changes are made, you will need to make a new distribution file. There are two ways to make a new distribution file detailed below.

Methods

Automatic distribution file creation (for development)

Run the following command in your terminal from the root of the Ekko client project directory. When any changes are made to lib/ekko.js, a new distribution file will be generated within the /dist directory. This file will be named based off the current npm project version and will overwrite any file that has the same name. This distribution file will not be minified to allow for easier troubleshooting.

npm run watch

Manual distribution file creation (for production)

When you are ready to generate the production version of your distribution file, run the below command to generate a new distribution file in the /dist directory. This file will be named based on the current npm project version and will overwrite any file that has the same name. This distribution file will be minified to reduce the size.

npm run build