mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +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) => {
|
handleWsUpgrade = async (context, token, res) => {
|
||||||
|
if (!token) {
|
||||||
|
return res.upgrade(context)
|
||||||
|
}
|
||||||
|
|
||||||
context = await InjectedAuth(context, token, res)
|
context = await InjectedAuth(context, token, res)
|
||||||
|
|
||||||
if (!context.user) {
|
if (!context.user) {
|
||||||
@ -30,13 +34,13 @@ export default class API extends Server {
|
|||||||
return res.upgrade(context)
|
return res.upgrade(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleWsConnection = (socket) => {
|
// handleWsConnection = (socket) => {
|
||||||
console.log(`[WS] @${socket.context.user.username} connected`)
|
// console.log(`[WS] @${socket.context.user.username} connected`)
|
||||||
}
|
// }
|
||||||
|
|
||||||
handleWsDisconnect = (socket) => {
|
// handleWsDisconnect = (socket) => {
|
||||||
console.log(`[WS] @${socket.context.user.username} disconnected`)
|
// console.log(`[WS] @${socket.context.user.username} disconnected`)
|
||||||
}
|
// }
|
||||||
|
|
||||||
contexts = {
|
contexts = {
|
||||||
db: new DbManager(),
|
db: new DbManager(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user