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

stayge-ws-client-sdk

v0.1.28

Published

Stayge WebSocket Client SDK

Readme

사용예시

-- 설치
npm install stayge-ws-client-sdk

React

import { getWebSocketClient, wsError } from "stayge-ws-client-sdk/react";

type Message = {
  title: string;
  body: string;
};

const ws = getWebSocketClient();

ws.connect({ url: "wss://dev.linc.fan/ws/linc" });

ws.onConnect(
  callback: () => {
    // connected
  },
);

// 이벤트 핸들러는 connect 이전에 등록 가능, 여러번 호출해서 멀티 핸들러 등록 가능
ws.onMessage<Message>({
  topic: "openchat/12345",
  callback: (topic, payload) => {
    // 서버에서 메시지가 수신되면 호출됨
    // payload는 Message 타입으로 넘어오고 sdk에서 JSON.parse() 후에 핸들러에 넘겨줌
    console.log(`Received: topic=${topic}, payload=${JSON.stringify(payload)}`);
  },
});

ws.onDisconnect({
  callback: () => {
    // 서버와 연결이 끊어지면 호출됨
    console.log(`onDisconnect`);
  },
});

ws.onError({
  callback: (error: wsError) => {
    // 서버에서 에러가 리턴되면 호출됨, 현재는 구독 에러만 정의됨
    if (error.code === "subscribeError") {
      setSubscribedTopics((prev) => prev.filter((t) => t !== error.topic));
    }
  },
});

React Native

import { getWebSocketClient, wsError } from "stayge-ws-client-sdk/react-native";

type Message = {
  title: string;
  body: string;
};

const ws = getWebSocketClient();

ws.connect({ url: "wss://dev.linc.fan/ws/linc" });

ws.onConnect({
  callback: () => {
    setConnected(true);
  },
});

// 이벤트 핸들러는 connect 이전에 등록 가능, 여러번 호출해서 멀티 핸들러 등록 가능
ws.onMessage<Message>({
  topic: "openchat/12345",
  callback: (topic, payload) => {
    // 서버에서 메시지가 수신되면 호출됨
    // payload는 Message 타입으로 넘어오고 sdk에서 JSON.parse() 후에 핸들러에 넘겨줌
    console.log(`Received: topic=${topic}, payload=${JSON.stringify(payload)}`);
  },
});

ws.onDisconnect({
  callback: () => {
    // 서버와 연결이 끊어지면 호출됨
    console.log(`onDisconnect`);
  },
});

ws.onError({
  callback: (error: wsError) => {
    // 서버에서 에러가 리턴되면 호출됨, 현재는 구독 에러만 정의됨
    if (error.code === "subscribeError") {
      setSubscribedTopics((prev) => prev.filter((t) => t !== error.topic));
    }
  },
});

SDK References

https://staygelabs.github.io/stayge-ws-client-sdk/

프로젝트 폴더 구조

stayge-ws-client-sdk/
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── vite.config.ts
├── src/
│   ├── index.ts               # 공통 진입점
│   ├── core/
│   ├── react/
│   └── react-native/
└── dist/                      # 빌드 산출물 (tsup)

빌드

npm run build

배포

deploy.patch.sh

SDK 문서 생성 & 업데이트

gen-docs.sh