feathersjs-ecosystem / socketio

[MOVED] The Feathers Socket.io websocket transport plugin
https://github.com/feathersjs/feathers
MIT License
37 stars 14 forks source link

Add headers and remote ip address to socket.feathers #67

Closed marshallswain closed 7 years ago

marshallswain commented 7 years ago

This is too common of a request to not be next on the list. There are a lot of headers that match between the transports: https://gist.github.com/marshallswain/b775c7b6d7a9b2429b0eb6fe669a2bfd

We don't currently expose these headers for sockets.

app.configure(socketio(function (io) {
  io.on('connection', function (socket) {
    Object.assign(socket.feathers, {headers: socket.handshake.headers});
    socket.feathers.ip = socket.conn.remoteAddress;
  });
}));
daffl commented 7 years ago

See discussion in https://github.com/feathersjs/feathers-primus/issues/46#issuecomment-293024630