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

meowslib

v8.6.1

Published

Minecraft websocket library

Downloads

51

Readme

MeoWebsocket library

简介

MWL是一个易于使用的Minecraft Websocket开发库

安装

npm install meowslib

代码实例

输出玩家聊天信息:

const MeoWS = require('meowslib');
const WSServer = MeoWS.WSServer;
const BuildSession = MeoWS.BuildSession;
let wss = new WSServer(23333);

wss.on('client', (session, request) => {
	console.log(request.connection.remoteAddress + ' connected!');
	session.tellraw('MeoWebsocket library v2.0.0 by CAIMEO.');
	BuildSession.createAndBind(session);
	session.on('onMessage',(msg, player)=>{
		console.log(`[${player}]Message: `, msg);
	});
});

事件监听器(此处订阅了BlockPlaced事件):

wss.on('client', (session, request) => {
	console.log(request.connection.remoteAddress + ' connected!');
	session.tellraw('MeoWebsocket library v2.0.0 by CAIMEO.');
	BuildSession.createAndBind(session);
  	session.subscribe("BlockPlaced", (json) => {
    	console.log("BlockPlaced:", json);
  })
});

API 文档

Class MeoWS.WSServer

  • port {Number} 服务器端口

Class MeoWS.BuildSession

  • socket {Session} 一般绑定WSServerSession

Class MeoWS.Parser

命令解析器

  • command {String} 用户命令
  • options {Object} 规则 返回一个Object

Events

onMessage

当玩家发送消息时触发,传入信息内容(message)和发送者(Sender)

onJSON

当玩家发送消息时触发,不同的是,它将传回json

onError

发生错误时触发,传回错误信息

onCommand

党玩家发送消息并被Parser解析完成时触发,传回object

Session

sendCommand(command, callback)

向客户端发送命令

  • command {String} 命令
  • callback {Function} 回调函数,传入json

sendCommandSync(command)

向客户端发送命令(Promise)

  • command {String} 命令

subscribe(event,callback)

订阅游戏事件

  • event {String} 游戏事件
  • callback {String}回调函数,传入json

unsubscribe(event)

取消订阅游戏事件

  • event {String} 游戏事件

sendText(text)

发送信息

  • text {String} 要发送的消息

tellraw(text, color)

tellraw代码

  • text {String} 要发送的消息
  • color {String} 颜色代码