fix: WebSocket wss:// same-origin URL + try/catch to prevent crash on HTTPS
- Change DEFAULT_WS_URL from ws://hostname:3001 to wss://window.location.host - Wrap WebSocket constructor in try/catch to prevent React crash on connection error - Fixes white page when opening a project (CADEditor crashed on insecure ws:// from HTTPS page)
This commit is contained in:
@@ -41,7 +41,7 @@ export interface UseYjsBindingResult {
|
||||
clearSelection: () => void;
|
||||
}
|
||||
|
||||
const DEFAULT_WS_URL = `ws://${window.location.hostname}:3001`;
|
||||
const DEFAULT_WS_URL = `wss://${window.location.host}`;
|
||||
|
||||
export function useYjsBinding(opts: UseYjsBindingOptions): UseYjsBindingResult {
|
||||
const { docName, wsUrl = DEFAULT_WS_URL, userId, userName, userColor, enabled = true } = opts;
|
||||
|
||||
Reference in New Issue
Block a user