mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 02:24:16 +00:00
support for ws connection without auth
This commit is contained in:
parent
93880e8abe
commit
bf2c04abc9
@ -20,6 +20,10 @@ export default class API extends Server {
|
||||
}
|
||||
|
||||
handleWsUpgrade = async (context, token, res) => {
|
||||
if (!token) {
|
||||
return res.upgrade(context)
|
||||
}
|
||||
|
||||
context = await InjectedAuth(context, token, res)
|
||||
|
||||
if (!context.user) {
|
||||
@ -30,13 +34,13 @@ export default class API extends Server {
|
||||
return res.upgrade(context)
|
||||
}
|
||||
|
||||
handleWsConnection = (socket) => {
|
||||
console.log(`[WS] @${socket.context.user.username} connected`)
|
||||
}
|
||||
// handleWsConnection = (socket) => {
|
||||
// console.log(`[WS] @${socket.context.user.username} connected`)
|
||||
// }
|
||||
|
||||
handleWsDisconnect = (socket) => {
|
||||
console.log(`[WS] @${socket.context.user.username} disconnected`)
|
||||
}
|
||||
// handleWsDisconnect = (socket) => {
|
||||
// console.log(`[WS] @${socket.context.user.username} disconnected`)
|
||||
// }
|
||||
|
||||
contexts = {
|
||||
db: new DbManager(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user