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

testsuckit

v0.1.0

Published

testsuckit Javascript library for browser and nodejs

Downloads

1

Readme

Websuckit Javascript Client

Test Deploy to NPM

This Websuckit client library supports web browsers and Node.js

For tutorials and more in-depth information about websuckit Channels, visit our official docs.

Usage Overview

The following topics are covered:

Supported platforms

  • Web
    • We test against Chrome, Firefox and Safari.
    • Works in web pages.
    • Works with major web frameworks, including
  • Node.js

Installation

Web

If you're using websuckit Channels on a web page, you can install the library via:

Yarn (or NPM)

You can use any NPM-compatible package manager, including NPM itself and Yarn.

yarn add @websuckit/js

Then:

import websuckit from '@websuckit/js';

Or, if you're not using ES6 modules:

const websuckit = require('@websuckit/js');

CDN

<script src="https://unpkg.com/@websuckit/[email protected]/dist/websuckit.umd.js"></script>

Node.js

Having installed @websuckit/js via an NPM-compatible package manager, run:

import websuckit from '@websuckit/js';

Initialization

const ws = new Websuckit({
  userId: USER_ID,
  accessKey: ACCESS_KEY,
  publicKey: PUBLIC_KEY,
})

You can get your USER_ID, ACCESS_KEY and PUBLIC_KEY from the websuckit dashboard.

Channel

Create channel

const channelResponse = ws.createChannel({
  channel: "channel_name", // channel should be a slug e.g test-channel
})

// Expected response
// {
//     channel: {
//         id: string;
//         name: string;
//         pass_key: string;
//         user_id: string;
//         created_at: string;
//         updated_at: string;
//     }
// }

Get channel

const channelResponse = ws.getChannel({
  channelName: "channel_name",
})

// Expected response
// {
//   id: string;
//   name: string;
//   pass_key: string;
//   user_id: string;
//   created_at: string;
//   updated_at: string;
// }

Get channels (paginated)

const channelResponse = ws.getChannels({
    page: "0", // page is 0 indexed
    per_page: "10",
    search_key: "channel_name"; // (optional) search channels by channel name
})

// Expected response
// {
//   id: string;
//   name: string;
//   pass_key: string;
//   user_id: string;
//   created_at: string;
//   updated_at: string;
// }[]

Get or Create channel

const channelResponse = ws.getOrCreateChannel({
  channelName: "channelName", // channel should be a slug e.g test-channel
})

// Expected response
// {
//   id: string;
//   name: string;
//   pass_key: string;
//   user_id: string;
//   created_at: string;
//   updated_at: string;
// }

Update channel

const channelResponse = ws.getOrCreateChannel({
    channelId: "<CHANNEL_UUID>",
    channel: "channel_name"
    regenerate_pass_key: false; // (optional) If regenerate_pass_key is true the channel passkey will be regenerated
})

// Expected response
// {
//     channel: {
//         id: string;
//         name: string;
//         pass_key: string;
//         user_id: string;
//         created_at: string;
//         updated_at: string;
//     }
// }

Delete channel

const channelResponse = ws.getOrCreateChannel({
    channelId: "<CHANNEL_UUID>",
})

// Expected response
// string

Accessing a channel's websocket URL

It is possible to access a channel websocket URL by channel name, through the getConnectionUrl function:

const connectionUrl = ws.getConnectionUrl({
  channelName: CHANNEL_NAME,
  channelPassKey: CHANNEL_PASSKEY,
})

// The expected return of the connectionUrl is a websocket connection e.g wss://backend.websuckit.com/e762eaad-397b-4af8-9376-a8eff2731966/bright/{encrypted_token}
  • channelName - name of channel
  • channelPassKey - channel passkey

Test SDK

yarn test

Run Locally

yarn install

yarn dev

Run SDK locally

  1. Run yarn build && cp package.json ./dist && cd dist && yarn link in the root directory.
  2. Next, Change directory into example folder and run cd ../example && yarn link "@websuckit/js"