facebook twitter hatena line google mixi email

Javascript/nodejs/socket.io/sessionid

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

ユーザ接続IDを取得

  • client.js
var socket = io.connect('http://cloudcore:8001');
socket.on('connect', function(msg) {
  console.log("sessionid:" + socket.socket.sessionid);
});
  • server.js
socket.on('connection', function(client) {
  console.log("sessionid:" + client.id);
}