---
title: WebSocket
description: >-
  通过 WebSocket 获取实时状态更新。只需在
  <code>ws://<panel>/ws</code> 建立一次连接，即可接收 JSON 消息流，无需轮询。需要经过身份验证的会话
  Cookie（不支持 Bearer token 身份验证）。每条消息都带有一个 <code>type</code> 字段，用于标识其载荷结构。
full: true
_openapi:
  preload:
    - ./public/openapi.json
  toc:
    - depth: 2
      title: >-
        Upgrade an HTTP connection to a WebSocket. Requires an authenticated
        session cookie (Bearer token auth is not supported here). Returns 101
        Switching Protocols on success. The server then pushes JSON messages
        described below.
      url: >-
        #upgrade-an-http-connection-to-a-websocket-requires-an-authenticated-session-cookie-bearer-token-auth-is-not-supported-here-returns-101-switching-protocols-on-success-the-server-then-pushes-json-messages-described-below
  structuredData:
    headings:
      - content: >-
          Upgrade an HTTP connection to a WebSocket. Requires an authenticated
          session cookie (Bearer token auth is not supported here). Returns 101
          Switching Protocols on success. The server then pushes JSON messages
          described below.
        id: >-
          upgrade-an-http-connection-to-a-websocket-requires-an-authenticated-session-cookie-bearer-token-auth-is-not-supported-here-returns-101-switching-protocols-on-success-the-server-then-pushes-json-messages-described-below
    contents: []
---

{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

export default function Layout(props) {
  const { APIPage, OpenAPIPage } = props.components ?? {};
  // "APIPage" is the old name from v10, this allows both for backward compatibility
  const Comp = OpenAPIPage ?? APIPage;
  return (
    <>
      {props.children}
      <Comp document="./public/openapi.json" webhooks={[]} operations={[{"path":"/ws","method":"get"}]} showTitle />
    </>
  );
}