> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-pixel-streaming-embed/on-premise-deployment.md).

# 本地部署

## 自定义服务 URL

默认情况下， `@convai/experience-embed` 库会连接到 Convai 托管的后端服务和虚拟机。然而，对于 **本地开发**，或者企业部署，您可能希望让流量通过您自己的后端和虚拟机。

为此，您可以使用以下方式覆盖默认服务 URL： `serviceUrls` 属性（React）或选项（Vanilla/TS/CDN）。

## 可用的服务 URL 覆盖项

| 键                 | 描述                                   |
| ----------------- | ------------------------------------ |
| `sessionFetch`    | 用于获取该体验会话数据的 URL                     |
| `pixelStreamBase` | 托管 Unreal Pixel Streaming 服务器的基础 URL |

## React 示例

```tsx
<PixelStreamComponent
  expId="your-experience-id"
  InitialScreen={<div>加载中...</div>}
  serviceUrls={{
    sessionFetch: 'https://your-backend.example.com/api/session',
    pixelStreamBase: 'https://your-streaming-server.example.com',
  }}
/>
```

## 原生 JS 示例

```ts
const pixelStream = new PixelStreamClient({
  container: document.getElementById('pixel-stream-container'),
  expId: 'your-experience-id',
  serviceUrls: {
    sessionFetch: 'https://your-backend.example.com/api/session',
    pixelStreamBase: 'https://your-streaming-server.example.com',
  }
});
```

## 何时使用此功能

* 您正在运行 **本地运行 Pixel Streaming 服务器** 或在一个 **私有云**.
* 您希望完全控制 **会话管理和安全性**.
* 您正在将该体验集成到一个 **更大的企业应用程序中** 并使用自定义网络。

这种灵活性使 SDK 能够集成到各种环境中，而无需更改核心库。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-pixel-streaming-embed/on-premise-deployment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
