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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kmo-plugin-sdk

v1.2.2

Published

SDK for plugins of the Kocka Másik Oldala webpage

Downloads

108

Readme

kmo-plugin-sdk

The kmo-plugin-sdk provides a simple interface for plugin developers to interact with the KMO platform. It supports initialization, role management, data persistence, and real-time messaging via WebSockets.


Installation

npm install kmo-plugin-sdk

or if using yarn:

yarn add kmo-plugin-sdk

Usage

import KMOPluginClient from "kmo-plugin-sdk";

// Initialize the plugin client
KMOPluginClient.init();

// Get the current user role
const role = KMOPluginClient.getCurrentRole();

// Data operations
await KMOPluginClient.data.save("myKey", { foo: "bar" });
const value = await KMOPluginClient.data.get("myKey");
await KMOPluginClient.data.remove("myKey");

// Messaging operations
KMOPluginClient.messaging.connect();

// Subscribe to incoming event and handle the response message
const unsubscribe = KMOPluginClient.messaging.subscribe((msg) => {
  console.log("Received message:", msg);
});

// Send messages or data for all subscribers
KMOPluginClient.messaging.broadcast({ defMessage: "Hello world" });

// Check connection status
if (KMOPluginClient.messaging.isConnected()) {
  console.log("WebSocket is connected");
}

// Disconnect when done
KMOPluginClient.messaging.disconnect();

// Unsubscribe when no longer needed
unsubscribe();

API Reference

Initialization

  • init(): Initializes the client.
  • getCurrentRole(): Role: Returns the role of the current user.

Data API

  • data.get(key: string): Promise<object | null> – Retrieves data by key.
  • data.save(key: string, value: object): Promise<void> – Saves data under the given key.
  • data.remove(key: string): Promise<void> – Removes data for the given key.

Messaging API

  • messaging.connect(): Promise<void> – Connects to the WebSocket server.
  • messaging.disconnect(): void – Disconnects from the WebSocket server.
  • messaging.subscribe(handler: (msg: unknown) => void): () => void – Subscribes to incoming messages. Returns an unsubscribe function.
  • messaging.broadcast(msg: unknown): void – Sends a command message.
  • messaging.isConnected(): boolean – Checks if WebSocket is connected.

Types

KMOPluginClientData

export type KMOPluginClientData = {
    get: (key: string) => Promise<object | null>,
    save: (key: string, data: object) => Promise<void>,
    remove: (key: string) => Promise<void>
}

KMOPluginClientMessaging

export type KMOPluginClientMessaging = {
    connect: () => WebSocket | undefined,
    disconnect: () => void,
    subscribe: (handler: (event: Event) => void) => () => void,
    sendCommand: (command: PluginCommand) => void,
    isConnected: () => boolean,
    onStatusChange: (cb: (status: Status) => void) => () => void
}

KMOPluginClientType

export type KMOPluginClientType = {
    init: () => void,
    getCurrentRole: () => Role,
    data: KMOPluginClientData,
    messaging: KMOPluginClientMessaging
}