Good day.
The problem arose when studying Sails.JS on sailsCasts ( http://irlnathan.imtqy.com/sailscasts/ )
When you start the application, the following error message is displayed in the log:
verbose: A socket is being allowed to connect, but the session could not be loaded. Will create an empty, one-time session to use for the life of the socket connection. Details: Error: Session could not be loaded at _createError (/home/feofanov/.nvm/versions/node/v0.12.5/lib/node_modules/sails/lib/hooks/session/index.js:271:21) at Immediate._onImmediate (/home/feofanov/.nvm/versions/node/v0.12.5/lib/node_modules/sails/lib/hooks/session/index.js:274:13) at processImmediate [as _immediateCallback] (timers.js:367:17) { [Error: Session could not be loaded] code: 'E_SESSION' } ... verbose: Could not fetch session, since connecting socket has no cookie (is this a cross-origin socket?) Generated a one-time-use cookie:sails.sid=s%3ArLsa3NEJesYaSpk2dgys0Y3UEAPISayv.xcswPCEfp3FOnIw%2FFk7s1NibIYhOl1CdJBF6IlK3P9Aand saved it on the socket handshake. This will start this socket off with an empty session, ie (req.session === {}) That "anonymous" section will only last until the socket is disconnected unless you persist the session id in your database, or by setting the set-cookie response header for an HTTP request that you *know* came from the same user (etc) Alternatively, just make sure the socket sends a `cookie` header or query param when it initially connects.
Tried to connect external session storage (Redis) - did not help.
Please advise which way to dig.