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

@mtop-devtools/cloud-connector

v1.37.0

Published

Cloud connector for Mtop DevTools — bridges cloud WebSocket server to local native-host

Readme

@mtop-devtools/cloud-connector

本地连接器,用于将本地的 native-host 通过 WebSocket 连接到云端 Server。

安装

npm install -g @mtop-devtools/cloud-connector
# 或
pnpm add -g @mtop-devtools/cloud-connector

使用

命令行方式

mtop-devtools-cloud-connector <server-url> [options]

参数:

  • server-url - 云端 WebSocket Server 地址(包含 token,如 ws://host:port/ws?token=xxx)

选项:

  • --heartbeat <seconds> - 心跳间隔(默认 30 秒)
  • --reconnect <ms> - 重连间隔(默认 5000 毫秒)
  • --max-reconnect <n> - 最大重连次数,-1 表示无限(默认 -1)

示例:

# 连接到本地测试服务器
mtop-devtools-cloud-connector "ws://localhost:8080/ws?token=xxx"

# 连接到云端服务器
mtop-devtools-cloud-connector "wss://cloud.example.com/ws?token=xxx"

# 自定义心跳和重连配置
mtop-devtools-cloud-connector "ws://localhost:8080/ws?token=xxx" --heartbeat 60 --max-reconnect 10

编程方式

import { CloudConnector } from '@mtop-devtools/cloud-connector';

const connector = new CloudConnector({
  serverUrl: 'wss://cloud.example.com/ws?token=xxx',
  heartbeatInterval: 30,
  reconnectInterval: 5000,
  maxReconnectAttempts: -1,
});

connector.connect();

// 优雅关闭
process.on('SIGINT', () => {
  connector.disconnect();
  process.exit(0);
});

前置条件

  1. 安装 @mtop-devtools/native-host

    npm install -g @mtop-devtools/native-host

    或使用本项目的 monorepo 构建产物。

  2. 确保 native-host 已初始化

    mtop-devtools-native-host --init
  3. 确保 Chrome 浏览器正在运行,且:

    • 已安装 Mtop DevTools 浏览器插件,或
    • 已在 chrome://inspect/#remote-debugging 启用远程调试(Chrome 145+)

架构

云端 Agent
  ↓
@mtop-devtools/cloud-client
  ↓
@mtop-devtools/cloud-server
  ↓ (WebSocket)
@mtop-devtools/cloud-connector (本进程)
  ↓ (Unix Socket)
@mtop-devtools/native-host
  ↓
Chrome Extension / CDP

注意事项

  • 本连接器需要保持运行状态,建议使用守护进程或 systemd/pm2 管理生命周期
  • 连接器会自动转发云端请求到本地 native-host
  • 支持断线自动重连(可在配置中调整)