简体   繁体   English

node.js socket.io&memcached-使用PHP会话ID作为Socket.IO昵称

[英]node.js socket.io & memcached - using PHP Session ID as Socket.IO Nickname

I understand if this is a silly questions. 我知道这是一个愚蠢的问题。

I have a site that is delivered by PHP and every user has a userid stored in a memcached SESSION. 我有一个由PHP提供的网站,每个用户的用户ID存储在内存缓存的SESSION中。

I'm also using node.js to deliver socket.io and using a nickname to know who the user is. 我还使用node.js传递socket.io,并使用昵称来知道用户是谁。 (eg: it passes the userid over when the connection is initially made). (例如:最初建立连接时,它将用户ID传递过来)。

Is there anyway to get node.js to connect to the PHP SESSION to get the user ID from there when the connection is made - this would avoid people being able to fake being people. 无论如何,在建立连接时是否有将node.js连接到PHP SESSION以从那里获取用户ID的方法-这样可以避免人们伪装成人。 (more secure). (更安全)。

Or are there better ways to go about this? 还是有更好的方法来解决这个问题? I would use SSL/HTTPS/WS but the site is HTTP and I believe mixing the 2 isn't allowed in some browsers now. 我将使用SSL / HTTPS / WS,但是该站点是HTTP,我认为现在某些浏览器中不允许混用2。

thankyou 谢谢

也许检查此npm以获取节点中的php会话: https : //npmjs.org/package/nodePhpSessions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM