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

@janocode/im-web-sdk

v1.0.4

Published

## 概述

Readme

IM Web SDK

概述

IM Web SDK 是一个用于即时通讯的客户端开发工具包,旨在简化与IM服务器的连接、消息发送和接收等操作。它提供了一套完整的API,帮助开发者快速集成即时通讯功能。

特性

  • 消息发送与接收:支持发送和接收即时消息,确保消息的可靠传输。
  • 重连机制:内置掉线重连机制,确保在网络中断后自动重连。
  • QoS支持:提供消息的质量保证服务,确保消息的送达和接收。
  • 事件回调:支持多种事件回调,开发者可以根据需要自定义处理逻辑。
  • 调试支持:提供调试选项,方便开发者进行问题排查。

解决的问题

  • 即时通讯集成:简化了与IM服务器的连接和通讯逻辑,减少了开发者的工作量。
  • 消息可靠性:通过QoS机制,确保消息在网络不稳定的情况下也能可靠送达。
  • 用户体验提升:通过事件回调机制,开发者可以实现更好的用户交互体验。

使用方法

初始化

import imsdk from './lib/main';

// 初始化SDK
imsdk.login('ws://example.com', 'userId', 'userToken');

发送消息

const message = {
    type: 'text',
    content: 'Hello, World!',
    to: 'receiverId'
};

imsdk.sendData(message);

事件回调

imsdk._callbacks.onIMData = (protocol) => {
    console.log('收到消息:', protocol);
};

imsdk._callbacks.onIMLoginSuccess = () => {
    console.log('登录成功');
};

imsdk._callbacks.onIMLoginFailure = (isReconnect) => {
    console.log('登录失败', isReconnect ? '重连失败' : '首次登录失败');
};

配置

SDK提供了一些配置选项,开发者可以根据需要进行调整:

  • wsUrl: WebSocket连接地址
  • _debug.enable: 是否开启调试模式
  • _debug.pingPongEnable: 是否开启心跳包调试

依赖

  • Protocol: 消息协议定义
  • QoS4SendDaemon: 消息发送质量保证
  • QosReceiveDaemon: 消息接收质量保证
  • Logger: 日志工具

贡献

欢迎对本项目进行贡献,您可以通过提交PR或Issue的方式参与到项目中。