Practical WebSocket Client with Auto-Reconnection and Real-Time Message Push for Vue 3
import EventBus from "@/utils/EventBus";
import { WS_ERROR_EVENT } from "@/config/constants";
import { getAuthToken } from "@/utils/auth";
const WS_BASE_URL = import.meta.env.VITE_WS_BASE_URL;
class WebSocketClient {
private enableAutoReconnect: boolean = true;
public reconnectAttempts: number = 0;
private ...
Posted on Fri, 08 May 2026 01:50:18 +0000 by johnnyboy16