New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@xmcl/client

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xmcl/client

Minecraft socket pipeline utilities. Support Minecraft lan server discovery.

  • 3.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

Client Module

npm version Downloads Install size npm Build Status

Minecraft socket pipeline utilities. Support Minecraft lan server discovery.

Usage

Ping Minecraft Server

Read sever info (server ip, port) and fetch its status (ping, server motd):

import { queryStatus, Status, QueryOptions } from '@xmcl/client'
const serverInfo = {
    host: 'your host',
    port: 25565, // be default
};
const options: QueryOptions = {
    /**
     * see http://wiki.vg/Protocol_version_numbers
     */
    protocol: 203,
};
const rawStatusJson: Status = await fetchStatus(info, options);

Detect LAN Minecraft Server

You can detect if player share LAN server.

Or you can fake a LAN server.

import { MinecraftLanDiscover, LanServerInfo } from '@xmcl/client'
const discover = new MinecraftLanDiscover();

await discover.bind(); // start to listen any lan server

discover.on('discover', ({ motd, port }: LanServerInfo) => {
    console.log(motd); // server motd
    console.log(port); // server port
})

const isReady = discover.isReady // a boolean represent whether the discover is ready to use

// you can also fake a lan server
discover.broadcast({
    motd: 'your motd',
    port: 2384 // fake port
});
// fake LAN server is useful when you want to implement the P2P connection between two players

dicover.destroy(); // stop listening

Keywords

FAQs

Package last updated on 10 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc