fix ws protocol (#117)

This commit is contained in:
UUBulb
2025-02-07 22:16:45 +08:00
committed by GitHub
parent 9b63e4fbda
commit 0a6b1c671f
2 changed files with 2 additions and 0 deletions

View File

@@ -162,6 +162,7 @@ const FMComponent: React.FC<FMProps & JSX.IntrinsicElements["div"]> = ({ wsUrl,
useEffect(() => {
const url = new URL(wsUrl, window.location.origin)
url.protocol = url.protocol.replace("http", "ws")
const ws = new WebSocket(url)
wsRef.current = ws
ws.binaryType = "arraybuffer"

View File

@@ -54,6 +54,7 @@ const XtermComponent = forwardRef<HTMLDivElement, XtermProps & JSX.IntrinsicElem
fontSize: 16,
})
const url = new URL(wsUrl, window.location.origin)
url.protocol = url.protocol.replace("http", "ws")
const ws = new WebSocket(url)
wsRef.current = ws
ws.binaryType = "arraybuffer"