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

@nnepoch/dtc-sdk

v3.0.4

Published

UE frontend SDK built on official Pixel Streaming frontend package

Readme

@nnepoch/dtc-sdk

面向 Unreal Engine 云渲染场景的前端 SDK,基于 Pixel Streaming 提供鉴权、WebRTC 连接和引擎 API 调用能力。

安装

npm install @nnepoch/dtc-sdk

快速开始

直接连接信令服务

<div id="app"></div>
<script type="module">
  import { DTCEngine } from '@nnepoch/dtc-sdk';

  const engine = new DTCEngine({
    signalingServer: 'https://signaling.example.com',
    sceneName: 'demo-scene',
    token: 'your-token',
    dom: document.getElementById('app'),
    viewMode: 'bs',
    showProgressBar: true,
    logger: 'info'
  });

  try {
    await engine.whenReady();
    console.log('引擎已连接');
  } catch (error) {
    console.error('引擎连接失败', error);
  }
</script>

通过中心服务鉴权

如果使用中心服务,可以传入 centerIP,SDK 会完成中心鉴权、服务分配和 WebRTC 连接:

import { DTCEngine } from '@nnepoch/dtc-sdk';

const engine = new DTCEngine({
  centerIP: 'https://center.example.com',
  sceneName: 'demo-scene',
  token: 'your-token',
  dom: document.getElementById('app') as HTMLDivElement
});

await engine.whenReady();

signalingServercenterIP 至少需要提供一个。两者同时提供时,SDK 优先使用 signalingServer 的直接连接模式。

常用配置

const engine = new DTCEngine({
  // 二选一:信令服务 HTTP 基地址或中心服务地址
  signalingServer: 'https://signaling.example.com',
  // centerIP: 'https://center.example.com',

  sceneName: 'demo-scene',
  token: 'your-token',
  dom: document.getElementById('app') as HTMLDivElement,

  // bs:浏览器流模式;cs:宿主协同模式
  viewMode: 'bs',
  showProgressBar: true,
  logger: 'info'
});

支持的日志级别:

silent | error | warn | info | debug

生命周期

// 等待首次鉴权和 WebRTC 连接完成
await engine.whenReady();

// 断开当前连接
engine.disconnect();

// 重新鉴权并连接
await engine.restart();

监听事件

engine.on(engine.Events.WebRtcConnected, () => {
  console.log('WebRTC connected');
});

engine.on(engine.Events.MapLoaded, () => {
  console.log('场景加载完成');
});

engine.on(engine.Events.EngineStatus, (status) => {
  console.log('引擎状态', status);
});

engine.on(engine.Events.ModelClick, (payload) => {
  console.log('模型点击', payload);
});

常用事件包括:

  • WebRtcConnected
  • WebRtcDisconnected
  • MapLoaded
  • EngineStatus
  • ModelClick
  • ModelTrigger
  • AuthStateChanged
  • NetworkLevelChanged

调用引擎 API

await engine.Camera.lookAt({
  parentId: 'ModelLayer',
  id: 'CameraTarget',
  time: 2,
  distance: 20
});

await engine.Screen.setSceneFPS({ fps: 30 });

await engine.Model.setVisible({
  parentId: 'ModelLayer',
  id: 'CameraTarget',
  visible: false
});

SDK 会在 API 调用前校验参数。参数不合法时,Promise 会抛出 SDKValidationError

try {
  await engine.Camera.lookAt({ id: '' });
} catch (error) {
  console.error(error);
}

完整 API 列表请查看:API 文档

浏览器脚本产物

如果不使用 npm 模块系统,也可以使用版本化的浏览器脚本:

<script src="./dist/browser/dtc-sdk-<version>.js"></script>
<script>
  const engine = new window.DTCEngine({
    signalingServer: 'https://signaling.example.com',
    sceneName: 'demo-scene',
    token: 'your-token',
    dom: document.getElementById('app')
  });
</script>

示例和文档

许可证

MIT