4
服务器代码:socket.io客户端无法获得授权失败的原因
//run with node-dev server.js
var remoteServer = io.of('/remote');
remoteServer.authorization(function(handshakeData, callback){
return callback('unknown clientType', false);
}
服务器日志:
You can visit your app with http://localhost:3000
info - handshake authorized l4FzYiWpHo2d8VeoB3Zo
warn - handshake error unknown clientType for /remote
客户端代码:
//run with node-dev client.js
var io = require('socket.io/node_modules/socket.io-client');
var client = io.connect('http://localhost:3000/remote');
client.on('connect_failed', function(reason){
console.log('connect_failed:', reason);
});
//will call this because it's Namespace authorization
client.on('error', function(reason){
console.log('error:', reason);
});
客户端日志:
//error reason miss.
E:\Workspace\TZ\SmartDoor\client>node-dev client.js
error:
阅读后src和测试,发现授权不允许自定义错误味精,只有回调(空,假的),然后客户端有:“错误:未授权” – atian25 2012-08-04 10:00:09
现在,我应该删除这个问题还是近?哪个操作 – atian25 2012-08-04 10:01:53
那么我怎么能告诉客户端授权更多细节失败msg? – atian25 2012-08-04 10:05:58