WebSocket authentication
Hello this is maybe a stupid question, but looking at the websocket page in the docs I couldn't determine if there is a way (or maybe it already exists by default and it's just not mentioned) to restrict websocket connections to only authenticated users?
5 Replies
i would guess that you just look for the user on the socker.data object and if it doesn't exist, then throw an error:
maybe @miho knows a better way
Ah that makes sense actually 😅
Thanks!
yeah let me know if it works after you've given it a try
Well throwing an error seems like it just crashes the whole thing, but I remembered that I can just do socket.disconnect()
instead of throwing an error
ok cool. yeah, sorry, i don;t have much experience with websockets