Spaces:
Runtime error
Runtime error
Download streaming-react-app/src/useSocket.ts from MACXXX/seamless-streaming: direct link, hf CLI and curl.
- Browser
- Download file 391 Bytes
-
https://huggingface.co/spaces/MACXXX/seamless-streaming/resolve/main/streaming-react-app/src/useSocket.ts
- Command line
-
hf download hf://spaces/MACXXX/seamless-streaming/streaming-react-app/src/useSocket.ts
-
curl -L -o useSocket.ts https://huggingface.co/spaces/MACXXX/seamless-streaming/resolve/main/streaming-react-app/src/useSocket.ts
391 Bytes
| import {createContext, useContext} from 'react'; | |
| import {Socket} from 'socket.io-client'; | |
| type SocketObject = { | |
| socket: Socket | null; | |
| clientID: string | null; | |
| connected: boolean; | |
| }; | |
| export const SocketContext = createContext<SocketObject>({ | |
| socket: null, | |
| clientID: null, | |
| connected: false, | |
| }); | |
| export function useSocket(): SocketObject { | |
| return useContext(SocketContext); | |
| } | |