Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- io.on('connection',function(socket){
- var authed = false;
- socket.on('auth',function(username,md5){
- var authServer = AUTH_SERVER + username;
- var buffer = new Buffer(md5);
- request({
- method : 'POST',
- uri : authServer,
- body : buffer
- },function(err,res,body){
- if (err)
- return;
- if (res.statusCode == 403)
- socket.emit('AuthFailed');
- else
- {
- socket.emit('AuthSucceed');
- authed = true;
- }
- })
- });
- socket.on('message',function(message) {
- socket.broadcast.emit('recmessage',message);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement