Skip to content
This repository was archived by the owner on Jan 31, 2019. It is now read-only.
This repository was archived by the owner on Jan 31, 2019. It is now read-only.

postAutheticate() question #34

@AlexisNi

Description

@AlexisNi

I want to send the userId from the client to server,so after the user is athenticated ,from then clinet side i want to emit the userId to the server .I would like to ask if there is a the right way of using postAuthentcate?I used like this
require('socketio-auth')(io, {
authenticate: function (socket, data, callback) {

    if (data.password=='123'){
        console.log('authenticated');
        return callback(null, true);
    }else{
        return callback(new Error('Wrong Password'));
    }
},
postAuthenticate:function(socket, data) {
    socket.on('get-userId',function (userId) {
        console.log('Welcome user : '+userId.userId);

    });
}

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions