socketstream/socketstream — Issue #144: Session ID Issues
Author: miningold
Created: 2012-02-13 05:41:31+00:00
State: open

I ran into a situation where the session id attached to a request looked something like this:
`79T71JVJIwK7OUl3sQQ4fze0.NFTQpIC%2FIuwAmXWU6iTCemqREp4`

but the session store (both connect-redis and the built-in session module) only wants the characters before the period:
`79T71JVJIwK7OUl3sQQ4fze0`

This means that calling `req.use('session');` would fail and not allow the rpc.

To fix this I edited the internal websocket session middleware to split the request's sessionId at the period and pass the first part to the findOrCreate method:

```
...
var sessionId = request.sessionId.split(".")[0];
return session.findOrCreate(sessionId, request.socketId, function(thisSession) {
...
```

An interesting thing to not is I would not run into this problem if I were using Chrome's incognito mode.