You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After connection user might be identified. Auth logic have to be in special function, that fires after connect and reconnect. User data has to be stored in connection.
User may be identified by an ID, and working with user has to be encapsulated.
user auth:
app.user('user-connected',connection=>{// connection is socket connection instance// connection.data contains queried credsletdata=connection.dataif('id'indata){db.findUserById(data.id).then(res=>{connection.setUser(data.id,res)// Client got message, that connection is allowedconnection.allow()}).catch(err=>{// Client got message, that connection is denied by serverconnection.deny({message: 'this ID not allowed to be authorized'})})}})
Roadmap
Support token getting
Support user events
Create User prototype
Support user object to keep connections
Make User class to work with connection
Add events support
first-connected
new-connected
last-connected
user-disconnected
The text was updated successfully, but these errors were encountered:
After connection user might be identified. Auth logic have to be in special function, that fires after connect and reconnect. User data has to be stored in connection.
User may be identified by an ID, and working with user has to be encapsulated.
user auth:
Roadmap
The text was updated successfully, but these errors were encountered: