Answer the question
In order to leave comments, you need to log in
Express + socket.io how to bundle?
Hello.
I am making a website using node.js with express and socket.io packages.
Something like this:
app.get('/rules', function(req, res)
{
fs.readFile("C:/Apache24/htdocs/site/rules.html", "utf-8", function(err, data)
{
if(err) throw err;
res.send(data);
});
});
io.on('connection', function (socket)
{
console.log("New user connected!");
socket.on('disconnect', function()
{
console.log('User disconnected!');
});
});
Answer the question
In order to leave comments, you need to log in
Faced the task of authorizing steam on node js + socket.
The essence of steam-login itself is to make sure that the user who provided you with data about the steam account is indeed the owner of it. Ie, steam authorization is primarily a check. After authorization through steam-login, you get the login of the user's steam account. From him and dance.
1) The user is authorized through steam-login. You get the user's login.
2) Create a cookie and bind it to login, add it to the database. Also set this cookie in the user's browser.
3) With socket connect, you get the browser cookies, look for the login in the database by the cookies, and that's it. Now you know which user is sending socket requests.
p.s. I used passport-steam instead of steam-login
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question