LearnBoost/socket.io — Issue #754: no way to handle peer certificates?
Author: jcayzac
Created: 2012-02-17 05:29:51+00:00
State: open

I don't see any way to access `req.connection` from inside socket.io's `authorization` callback. Is there any? I need to access the peer certificate to get the identity of the connected user (over wss://)

Currently I must hot-swap `Manager.handshakeData` for the method below, which adds the peer certificate to the data passed to the `authorization` callback, but it would be nice to have a clearly defined way.

```js
if (typeof io.Manager.prototype._handshakeDataPC !== "function") {
io.Manager.prototype._handshakeDataPC = io.Manager.prototype.handshakeData
io.Manager.prototype.handshakeData = function(data) {
var d = this._handshakeDataPC(data),
connection = data.request.connection
d['peer certificate'] = connection.authorized ? connection.getPeerCertificate() : null
return d
}
}
```