This file (1kB) exceeds the allowed full mode (48 kb) size. The editor full height is disabled, only scrolling is allowed.
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height mode.
import { Server } from 'socket.io'
import { resolveConfiguredHttpAuth, verifyAuthToken } from '../../lib/http-auth.mjs'
import socketHandler from './socket.mjs'
const socketIoService = function () {
const self = this;
self.boot = async (options) => {
const httpService = options.httpService
const socketio = new Server(httpService.server, {
secure: true,
path: '/socket.io',
maxHttpBufferSize: 256 * 1024 * 1024, // 256 MB
});
socketio.use((socket, next) => {
const httpAuth = resolveConfiguredHttpAuth()
if (!httpAuth.enabled) {
next()
return
}
const token = socket.handshake.auth?.token
if (token && verifyAuthToken(token)) {
next()
return
}
const error = new Error('auth_required')
next(error)
})
socketHandler(socketio);
this.socketio = socketio
}
}
export default socketIoService
| / | Focus search |
| ? | Show this help |
| Esc | Unfocus input |