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

@oichat/sdk

v0.1.1

Published

OiChat TypeScript SDK — Real-time chat SDK for web and React Native

Readme

@oichat/sdk

Real-time chat SDK for web and React Native — REST API client + Centrifugo WebSocket integration.

한국어 | English

Installation

npm install @oichat/sdk
# or
yarn add @oichat/sdk

Quick Start

Server Mode

Your backend issues JWT tokens and passes them to the client.

import { OiChat } from "@oichat/sdk";

const oichat = OiChat.init(
  {
    apiUrl: "https://api.oichatapi.com",
    wsUrl: "wss://ws.oichatapi.com/connection/websocket",
    projectId: "proj_xxxxxxxxxxxx",
    secretKey: "sk_xxxxxxxxxxxx",
  },
  { userId: "user-123" },
);

// Connect with JWT token from your backend
await oichat.realtime.connect({ token: jwtFromServer });

Client Mode

SDK handles token issuance and auto-refresh internally.

import { OiChat } from "@oichat/sdk";

const oichat = await OiChat.initClient(
  {
    apiUrl: "https://api.oichatapi.com",
    wsUrl: "wss://ws.oichatapi.com/connection/websocket",
    projectId: "proj_xxxxxxxxxxxx",
    publicKey: "pk_xxxxxxxxxxxx",
  },
  { userId: "user-123", userName: "John Doe" },
);

Core APIs

Rooms

// List rooms
const { data, next_cursor } = await oichat.rooms.list({ limit: 20 });

// Create room
const room = await oichat.rooms.create({
  type: "group",
  name: "Support Chat",
  participant_ids: ["user-1", "user-2"],
});

Messages

// Subscribe to a room
const sub = await oichat.realtime.subscribeRoom("room-id");

// Listen for new messages
sub.onMessage((message) => {
  console.log(message.content);
});

// Send a message
await oichat.messages.send({
  room_id: "room-id",
  content: "Hello!",
  content_type: "text",
});

Real-time Events

// Typing indicator
sub.onTyping((event) => {
  console.log(`${event.user_id} is typing...`);
});

// Read receipts
sub.onRead((event) => {
  console.log(`${event.user_id} read messages`);
});

// Connection state
oichat.realtime.onConnectionStateChange.on((state) => {
  console.log("Connection:", state); // 'connecting' | 'connected' | 'disconnected'
});

Push Notifications

// Register FCM token
await oichat.push.registerToken({
  token: fcmToken,
  device_type: "web",
});

File Upload

// Upload with progress
const result = await oichat.messages.sendWithAttachment({
  room_id: "room-id",
  file,
  onProgress: (percent) => console.log(`${percent}%`),
});

Cleanup

// Disconnect and release resources
oichat.dispose();

Links


한국어

모바일 앱과 웹에 채팅을 붙이는 가장 쉬운 방법 — REST API 클라이언트 + Centrifugo WebSocket 실시간 통신.

설치

npm install @oichat/sdk
# 또는
yarn add @oichat/sdk

빠른 시작

서버 모드

백엔드에서 JWT 토큰을 발급하여 클라이언트에 전달하는 방식입니다.

import { OiChat } from "@oichat/sdk";

const oichat = OiChat.init(
  {
    apiUrl: "https://api.oichatapi.com",
    wsUrl: "wss://ws.oichatapi.com/connection/websocket",
    projectId: "proj_xxxxxxxxxxxx",
    secretKey: "sk_xxxxxxxxxxxx",
  },
  { userId: "user-123" },
);

// 백엔드에서 받은 JWT 토큰으로 연결
await oichat.realtime.connect({ token: jwtFromServer });

클라이언트 모드

SDK가 자동으로 토큰 발급/갱신 + 연결을 처리합니다.

import { OiChat } from "@oichat/sdk";

const oichat = await OiChat.initClient(
  {
    apiUrl: "https://api.oichatapi.com",
    wsUrl: "wss://ws.oichatapi.com/connection/websocket",
    projectId: "proj_xxxxxxxxxxxx",
    publicKey: "pk_xxxxxxxxxxxx",
  },
  { userId: "user-123", userName: "홍길동" },
);

주요 기능

| 기능 | 설명 | | ------------- | ------------------------- | | 채팅방 관리 | 생성, 목록, 참여, 나가기 | | 실시간 메시징 | Centrifugo WebSocket 기반 | | 프레전스 | 온라인/오프라인 상태 추적 | | 파일 업로드 | 이미지, 파일 전송 지원 | | 푸시 알림 | FCM 토큰 등록 | | 멀티 테넌트 | 프로젝트 단위 데이터 격리 |

관련 링크

License

MIT