This commit is contained in:
Annie Huang authored and wancat committed 2023-08-17 19:43:55 +08:00
1 parent dee7e6975e
commit 6e0682881b
1 file changed
+6 -13
+6 -13
View File
@@ -4,19 +4,12 @@ import Session from '../models/session.js'
import { defaultUser, genSessionJWT } from '../utils/auth.js' import { defaultUser, genSessionJWT } from '../utils/auth.js'
export default (server) => { export default (server) => {
const io = new Server( const io = new Server(server, {
server, cors: {
{ origin: '*',
cors: {
origin: '*',
},
}, },
{ })
cors: {
origin: '*',
},
}
)
io.use(async (socket, next) => { io.use(async (socket, next) => {
console.log('Authenticating...') console.log('Authenticating...')
try { try {
@@ -61,7 +54,7 @@ export default (server) => {
const stream = await attachContainer(container, { token }) const stream = await attachContainer(container, { token })
stream.on('data', (chunk) => { stream.on('data', (chunk) => {
socket.send(chunk.toString().toString()) socket.send(chunk.toString())
}) })
socket.on('message', function incoming(message) { socket.on('message', function incoming(message) {