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

bfsocket.io

v0.3.0

Published

bfsocket.io is WebSocket client

Readme

BFSocket.IO

Realtime application framework client

How to installtion?

# yarn
yarn add bfsocket.io -S --registry=https://registry.npmjs.org/

# npm
npm i bfsocket.io -S --registry=https://registry.npmjs.org/

How to use?

import SocketIO from 'bfsocket.io';

const io = new SocketIO({
  url:'ws://example.com',
  heart: {
    data:{},
    delay: 5000
  }
  ......
})

io.on('your cmd', data => {
  console.log(data)
});

io.emit('your cmd', {});

instantiation options

  • url
    • Socket server URL
    • 要链接socket服务的URL
  • protocols
    • A protocol string or an array containing protocol strings
    • 一个协议字符串/一个包含协议字符串的数组。这些字符串用于指定子协议,这样单个服务器可以实现多个WebSocket子协议(例如,您可能希望一台服务器能够根据指定的协议(protocol)处理不同类型的交互)。如果不指定协议字符串,则假定为空字符串
  • heart
    • Socket send heart data
    • 发送 socket 心跳包
  • heart.data
    • heart data
    • 心跳包数据
  • heart.delay
    • Set how often to send in milliseconds
    • 设置多久发送一次 单位 毫秒
  • session
    • Socket session
  • uniqueid
    • Socket uniqueid (Automatically generated by default)
    • Socket 唯一身份ID (默认自动生成)
  • remillisecond
    • Socket reconnect interval. default 1000ms
    • Socket 重连间隔 单位 ms 默认 1000ms
  • reconnectlimit
    • The maximum number of Socket reconnections. default 10
    • Socket 最大重连次数 默认 10 次

functions

  • io.on<T extends unknown>(event: string, cb: (data: T) => void): void

    • Listen for socket server events
    • 监听socket服务端事件
  • io.emit(event: string, data: SocketIODispatchParams): void

    • Trigger socket server event
    • 触发socket服务端事件
  • io.setHeartData(data: SocketIODispatchParams): void

    • Set heart data
    • 设置心跳发送的数据
  • io.close():void

    • Closed Socket connect and disable reconnect
    • 手动关闭连接 并 停止重连
  • HOOK

    • io.onConnected(fn:() => void)
      • Socket connecnted event
    • io.onDistory(fn: () => void)
      • Socket close event