Spaces:
Paused
Paused
Download src/services/socket.ts from shanshal66/chinak: direct link, hf CLI and curl.
- Browser
- Download file 412 Bytes
-
https://huggingface.co/spaces/shanshal66/chinak/resolve/main/src/services/socket.ts
- Command line
-
hf download hf://spaces/shanshal66/chinak/src/services/socket.ts
-
curl -L -o socket.ts https://huggingface.co/spaces/shanshal66/chinak/resolve/main/src/services/socket.ts
412 Bytes
| /// <reference types="vite/client" /> | |
| import { io } from 'socket.io-client'; | |
| import { getBaseDomain } from './api'; | |
| const SOCKET_URL = getBaseDomain(); | |
| export const socket = io(SOCKET_URL, { | |
| autoConnect: false, | |
| }); | |
| export const connectSocket = () => { | |
| if (!socket.connected) { | |
| socket.connect(); | |
| } | |
| }; | |
| export const disconnectSocket = () => { | |
| if (socket.connected) { | |
| socket.disconnect(); | |
| } | |
| }; | |