feat: implement websocket URL creation and enhance websocket connection logging

This commit is contained in:
mlogclub
2026-04-14 19:59:49 +08:00
parent 2222256f5a
commit 0f3d110018
5 changed files with 27 additions and 8 deletions
+2 -3
View File
@@ -1,5 +1,6 @@
import { readSession } from "@/lib/auth"
import { request } from "@/lib/api/client"
import { createWebSocketBaseUrl } from "@/lib/api/websocket"
export type Paging = {
page: number
@@ -542,9 +543,7 @@ export function createAdminWebSocketUrl() {
throw new Error("未登录或登录已过期")
}
const baseUrl = (
process.env.NEXT_PUBLIC_API_BASE_URL?.trim() || ""
).replace(/^http/, "ws")
const baseUrl = createWebSocketBaseUrl()
const params = new URLSearchParams({
accessToken: session.accessToken,
})