JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 139
  • Score
    100M100P100Q61307F
  • License GPL-3.0-only

This is a tool to connect with MinecraftBE via websocket easier.

Package Exports

  • socket-be

Readme

English | 日本語

SocketBE

A powerful websocket library to interact with MCBE WebSocket Protocol

image

Features

  • Fully typed vanilla event handler
  • Command execution + Handling responses
  • Multiple connection support
  • Various wrapper APIs (World, Player, Scoreboard, etc.)
  • Encryption support

Installation:

Requires Node.js v18 or later.

npm install socket-be

Running:

If you use this inside same device, allow the loopback connection.
CheckNetIsolation.exe LoopbackExempt -a -n="Microsoft.MinecraftUWP_8wekyb3d8bbwe"

You can use /wsserver or /connect command to connect with websocket server.
EX: /wsserver <IP Address>:<PORT>

Usage

  • Outputs received messages in console, and send back to mc
import { Server, ServerEvent } from 'socket-be';

const server = new Server({ port: 8000 })

server.on(ServerEvent.Open, () => {
  console.log('Server started')
});

server.on(ServerEvent.PlayerChat, async ev => {
  const { sender, message, world } = ev;

  if (sender.name === 'External') return; // prevents spam loop

  console.log(`<${sender.name}> ${message}`);

  if (message === 'ping') {
    await world.sendMessage('Pong!');
  }
});

License

This project is licensed under the GPL-3.0 License.