MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / makeSocketIo

Function makeSocketIo

frontend/src/hooks/useSocketIo.ts:19–30  ·  view source on GitHub ↗
(addr: string, prefix?: string)

Source from the content-addressed store, hash-verified

17}
18
19export function makeSocketIo(addr: string, prefix?: string) {
20 prefix = removeTrail((prefix ?? "").trim(), "/");
21 return io(parseForwardAddress(addr, "ws"), {
22 path: prefix + "/socket.io",
23 multiplex: false,
24 reconnectionDelayMax: 1000 * 10,
25 timeout: 1000 * 30,
26 reconnection: true,
27 reconnectionAttempts: 3,
28 rejectUnauthorized: false
29 });
30}
31
32export function useSocketIoClient() {
33 let socket: Socket<DefaultEventsMap, DefaultEventsMap> | undefined;

Callers 2

executeFunction · 0.90
testConnectFunction · 0.85

Calls 2

removeTrailFunction · 0.90
parseForwardAddressFunction · 0.90

Tested by

no test coverage detected