Add documentation

This commit is contained in:
2025-08-22 22:01:51 +03:00
Unverified
parent deb02a5e95
commit eb85e68fc2
23 changed files with 931 additions and 364 deletions
+19 -2
View File
@@ -1,13 +1,30 @@
/**
* @fileoverview WebSocket connection management for real-time chat
* @description Handles WebSocket connections, message processing, and auto-reconnection
* @author Cursor
* @version 1.0.0
*/
import { currentUser } from "./auth";
import { addMessage } from "./chat";
import { API_FULL_BASE_URL } from "./config";
import type { WebSocketMessage, Message } from "./types";
import { delay } from "./utils";
import { delay } from "./utils/utils";
function create() {
/**
* Creates a new WebSocket connection to the chat server
* @function create
* @returns {WebSocket} New WebSocket instance
* @private
*/
function create(): WebSocket {
return new WebSocket(`ws://${API_FULL_BASE_URL}/chat/ws`);
}
/**
* Global WebSocket instance
* @type {WebSocket}
*/
export let websocket = create();
// --------------