4
  • socket.io@0.9.9
  • socket.io-client@0.9.9
  • express@3.0.0rc1

サーバーコード:

//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:
4

1 に答える 1