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

broadcastnodejs

v0.0.9

Published

server端主动发送广播给客户端

Downloads

16

Readme

广播

server端主动发送广播给客户端

client

client分为:user和group两种。

user是指一个user在只允许一个链接注册(一个链接对应js意味着一个io.connection)。

group是指一个group可以允许多个链接注册。

调用register事件进行注册,

注册完成之后,假如有第三方或者服务内部需要发送给你信息,那么会根据你注册的user和group进行数据发送,你们之间只需约定好事件名称即可。

假如需要注销,不再收到消息,则可以调用unRegister事件进行注销。

broadcastInfo用于第三方发送给对应user或者group数据,相应事件eventName和内容text(内容可以是文本或者json)。

注:假如发送目标group包含发送人自己,发送人是不会收到消息的。

client javascript

请求目录下有对应JS包,目前采用socket.io 2.1.0

  • 代码例子

客户端可以发送三个公共事件:register,unRegister,broadcastInfo。

register

  • 用户名,重复注册,会自动注销之前注册的用户

例子:{"user": "6A2C1FBC70FE38EEE050007F010061E5"}

  • 群组,允许重复注册

例子:{"group": "vvv"}

unRegister

  • 注销用户名

例子:{"user": "6A2C1FBC70FE38EEE050007F010061E5"}

  • 注销群组

例子:{"group": "vvv"}

broadcastInfo

  • roomName 发送房间名

  • eventName 发送事件名称

  • text 发送内容

例子:{"roomName":"xxx","eventName":"countMsg","text":"99"} {"roomName":"xxx","eventName":"countMsg","text":{"data","sdfdsf"}}

client java

之后补充!!!!

npm:This link

docket:This linke