Download server/app/utils/ws-tool.js from jimlv/ssh: direct link, hf CLI and curl.
- Browser
- Download file 405 Bytes
-
https://huggingface.co/spaces/jimlv/ssh/resolve/main/server/app/utils/ws-tool.js
- Command line
-
hf download hf://spaces/jimlv/ssh/server/app/utils/ws-tool.js
-
curl -L -o ws-tool.js https://huggingface.co/spaces/jimlv/ssh/resolve/main/server/app/utils/ws-tool.js
405 Bytes
| const { Server } = require('socket.io') | |
| const { verifyWsAuthSync } = require('./verify-auth') | |
| const createSecureWs = (httpServer, path, otherConfig = {}) => { | |
| const serverIo = new Server(httpServer, { | |
| path, | |
| cors: { | |
| origin: true, | |
| credentials: true | |
| }, | |
| ...otherConfig | |
| }) | |
| // 鉴权 | |
| serverIo.use(verifyWsAuthSync) | |
| return serverIo | |
| } | |
| module.exports = { | |
| createSecureWs | |
| } |