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

ew-sdk

v1.0.0

Published

sdk for express waas

Downloads

2

Readme

Express WaaS SDK

Getting Started

npm i ew-sdk

Initiating your Server

import { EWServer } from 'ew-sdk'

const server = new EWServer({
    encryption: 'AUTO' | 'NONE' | { publicKey: '', privateKey: '' },
    log: false | true,
    serverLocation: 'INDIA-CENTRAL',
})

server.connect(SERVER_TOKEN, [
    {
        name: "topic1",
    },
    ...
])

server.connect() is an async method. SERVER_TOKEN will be provided from the dashboard after adding your server. All the configuration will be fetched from cloud. You can use you RSA keypairs or use AUTO encryption mode for SDK to generate keypairs automatically.

Server API

1. Custom Authentication

This is an event based custom authentication hook. You can access or use query section of Client for custom authentication.

server.customAuthentication(({ query, client_socket_id }) => {
    // some calculation
    // authentication code
    return true | false
})

2. Recieving messages from clients

This method can be used to recieve messages from any clients.

server.on_client_msg(data => {})

3. Broadcasting Data

await server.broadcast(data)

4. Publishing to a topic

await server.publish(topicName, data)

Initiating a Client

import { EWClient } from "ew-sdk"

const client = new EWClient({
	namespace: NAMESPACE,
	log: false | true,
	serverLocation: "INDIA-CENTRAL",
})

await client.connect({
    token: CLIENT_TOKEN,
    type: "ANONYMOUS",
    ref: "SERVER",
    topics: [
        {
            name: "topic1",
        },
        ...
    ],
    query:{
        ...
    }
})

You can use query section for any data to pass along with the connection request. It can also be used for custom authentication.

Note: Client automatically syncs encryption settings with the server its connected to.

Client API

1. Subscribing to topics

await client.subscribe(['Topic1', 'Topic2',...])

2. Unsubscribing to topics

await client.unsubscribe(['Topic1', 'Topic2',...])

3. Recieving Updates

client.on(topicName, (...publishedData) => {})

Note: You can have multiple hooks on same topic!

4. Recieving Broadcasted Updated

client.onBroadcast((...broadcastedData) => {})

Note: You can have multiple hooks.

5. Send

await client.send(data)

E2EE

If E2EE is on, SDK will handle the encryption and decryption of data automatically.