Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7088299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:47:00+00:00 2026-05-28T07:47:00+00:00

I’m using Socket.IO with Node.js. I have an object socket which looks like this:

  • 0

I’m using Socket.IO with Node.js.

I have an object socket which looks like this:

SocketNamespace
    $events: Object
    ...
    socket: Socket

So then If I look at Socket (i.e. socket.socket)

Socket
    $events: Object
    ...
    sessionid: "1549988601982716407"

Again, works fine.

But if I just want to return sessionid, so I use socket.socket.sessionid I get…

undefined

If I do a typeof for socket.socket I get object, but for socket.socket.sessionid, I just get undefined.


Edit: here’s my code:

Browser:

$(function() {

    $.getScript('http://localhost:8080/socket.io/socket.io.js', function() {
        var socket = io.connect('http://localhost:8080');
        console.log(socket.socket.sessionid);
    });

});

App:

var io = require('socket.io').listen(8080);

io.sockets.on('connection', function (socket) {

});

Edit 2: More data:

Instead of the one log, I’ve replace with this;

console.log(typeof(socket));
console.log(typeof(socket.socket));
console.log(typeof(socket.socket.sessionid));

Returns:

object
object
undefined

Expected:

object
object
string

Edit 3:* Screenshot

Screenshot of console


Edit 4

This, oddly, works.

var x;
for (x in socket.socket)
{
    if (x == 'sessionid') {
        console.log(socket.socket[x]);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:47:01+00:00Added an answer on May 28, 2026 at 7:47 am

    I can’t believe this.

    socket.socket['sessionid']
    

    That worked. Thanks all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using node.js socket.io-client and socket.io . I have a javascript program which
I'm using the socket.makefile method to create a file-like object on a UDP socket
I'm using Socket.IO on Node.js. The Example here: http://socket.io/#how-to-use First Example. I have tested
Here's my problem: I have server A, running node.js and using socket.io for communicating
Okay, I have a simple test server set up using socket.io in node.js. My
I have a socket.io server using redis called server.js that fires up a node
I have built my application using node.js, mongodb, redis, express, socket.io and planning to
I have created a small server for communication using node.js and socket io Server:
I use node.js and socket.io. I am using the latest version socket.io. I have
I'm interested in using Node.js as a socket server for stream-based communication with tens

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.