WebSocketFactory
import { WebSocketFactory } from "https://esm.sh/@supabase/supabase-js@2.101.0/dist/index.d.mts";Utilities for creating WebSocket instances across runtimes.
class WebSocketFactory { }
private constructor();
static private detectEnvironment;
static getWebSocketConstructor(): WebSocket;
static isWebSocketSupported(): boolean;
§Static Properties
§Static Methods
§
getWebSocketConstructor(): WebSocket
[src]Returns the best available WebSocket constructor for the current runtime.
@example
Example with error handling
try {
const WS = WebSocketFactory.getWebSocketConstructor()
const socket = new WS('wss://example.com/socket')
} catch (error) {
console.error('WebSocket not available in this environment.', error)
}