Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get client's address? #20

Open
figozhu opened this issue Apr 11, 2019 · 1 comment
Open

how to get client's address? #20

figozhu opened this issue Apr 11, 2019 · 1 comment

Comments

@figozhu
Copy link

figozhu commented Apr 11, 2019

there is no address / remoteAddress on connection object

add console to display connection object:

const server = turbo.createServer(function (socket) {
  console.log("connection info: ", socket);

log:

connection info:  Connection {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  closed: false,
  finished: false,
  ended: false,
  allowHalfOpen: false,
  writable: true,
  readable: true,
  _index: 0,
  _server: 
   Server {
     domain: null,
     _events: { connection: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     connections: [ [Circular] ],
     allowHalfOpen: false,
     _closed: false,
     _address: '0.0.0.0',
     _handle: <Buffer a0 09 43 03 00 00 00 00 80 97 e4 01 00 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 37 3e 03 00 00 00 00 18 d6 3d 03 00 00 00 00 00 00 ... > },
  _handle: <Buffer 00 37 3e 03 00 00 00 00 80 97 e4 01 00 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 a3 3d 03 00 00 00 00 c0 09 43 03 00 00 00 00 00 00 ... >,
  _reads: 
   RequestQueue {
     size: 8,
     mask: 7,
     handle: 0,
     top: 0,
     btm: 0,
     list: 
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ] },
  _writes: 
   RequestQueue {
     size: 16,
     mask: 15,
     handle: 192,
     top: 0,
     btm: 0,
     list: 
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ] },
  _finishing: [],
  _closing: [],
  _paused: true,
  _queued: null }
@LuKks
Copy link

LuKks commented Apr 11, 2019

#15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants