node.js - Accessing the session on socket requests with sails.js -


when making client request using io.socket such as;

io.socket.post('activity/subscribe') 

there no session information appended request object in sails causing authentication policies fail.

this not cross-domain request , sails.sid cookie has been set. i'm using redis session store , xhr requests session populated correctly.

my understanding sails handles integration of sockets when requests reached app's routes can treated other request?

i've had @ answer in sails.js authorization socket requests fails req.socket.manager not defined. maybe that's older version of sails? in v0.11.0.

after sending post request, see following in console:

verbose: receiving incoming message socket.io:  { method: 'post',   headers: {},   data: {},   url: 'activity/subscribe' } verbose: interpreting socket.io message virtual request "post activity/subscribe"... error: policy error here no session.. 

we figured out eventually...

'activity/subscribe' - no good

'/activity/subscribe' - yay


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -