Tuesday, 11 April 2017

Authenticate and guard sockets nodejs

I'd like to create a real time application using socket.io.

I explain myself:

    UserModel {
       name: string,
       password: string,
       ...
    }

    ResourceModel {
       name: string,
       ...
    }

    AccessModel {
       resource: ResourceModel,
       user: UserModel
    }

When an user post/edit a resource, I'd like to notify all users having access to this resource.

I'm thinking about a solution, but I don't know if this is a good solution or if there is any other best way to do it:

create a room by user ('room-user-[userid]') and loop over all users to send an event in all users room.

Thanks for reading me ! :)

Have a nice day !



via hayato

No comments:

Post a Comment