You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was having issues getting session.socket.io to work, though after a bit of debugging, I've finally traced and put a bandaid on the issue - though my patch is a bit dirty, and I'm unsure if I've missed something that may be the origin of this issue.
So getCookie was returning something along the following (from handshake.cookies): s:[sessionId].[trailingCharacters]
Wherein [sessionId] was the valid session id.
The sessionStore.load method is looking only for the session id, and thus it failed to get the session because of this issue. By using simple string manipulation, I was able to get the actual session id out of the cookie value, thus making the entire module work.
So I changed this line: sessionStore.load(findCookie(socket.handshake), function (storeErr, session) {
to this: sessionStore.load(findCookie(socket.handshake).substring(2).split('.')[0], function (storeErr, session) {
It errors out without the change I've made. With the change I've made, upon loading for the second time, it shows that the session test var is 1, as expected.
FYI, I'm using the latest version (as of 04/08/2013) of all the modules required in the aforementioned test code.
The text was updated successfully, but these errors were encountered:
I was having issues getting session.socket.io to work, though after a bit of debugging, I've finally traced and put a bandaid on the issue - though my patch is a bit dirty, and I'm unsure if I've missed something that may be the origin of this issue.
So getCookie was returning something along the following (from handshake.cookies):
s:[sessionId].[trailingCharacters]
Wherein [sessionId] was the valid session id.
The sessionStore.load method is looking only for the session id, and thus it failed to get the session because of this issue. By using simple string manipulation, I was able to get the actual session id out of the cookie value, thus making the entire module work.
So I changed this line:
sessionStore.load(findCookie(socket.handshake), function (storeErr, session) {
to this:
sessionStore.load(findCookie(socket.handshake).substring(2).split('.')[0], function (storeErr, session) {
Here's a gist of test code that I've used to reproduce this issue: https://gist.github.com/TimeBomb/d992c84401d6e02b1c77
It errors out without the change I've made. With the change I've made, upon loading for the second time, it shows that the session test var is 1, as expected.
FYI, I'm using the latest version (as of 04/08/2013) of all the modules required in the aforementioned test code.
The text was updated successfully, but these errors were encountered: