![]() I seem to clearly lack the general understanding that would allow me to know what approach I should be going for so any help is welcome. Or should I find a way to make the socket connection happen in the initial HTTP call the client uses to join a table, which is what I initially wanted?īut really I'm kinda lost because I'm telling myself maybe I don't even need Express anymore and I should just use socket.io for everything. So should I do all the checks in the "io.on('connection'.)" function and somehow manage to make sure the client is authenticated within the callback of io.on('connection',callback) ? So for me, the way I'm doing this seems pretty bad since "app.post('/Table/ConnectSocketToTable'.)" and "io.on('connection'.)" are two different request listening functions I feel I should probably just do everything in one. GetTable().requestUnsitUsername() Ĭonsole.log( +" was disconnected so now requesting unsit") Ĭonsole.log("the socket of "++" has being connected to table-"+) Averagely Like this: const express = require("express")Īpp.get('/home',connectEnsureLogin.ensureLoggedIn("/loginPage"),function(req, res) `) ![]() I use Node.js socket.io/express-session/passportĪt first, I mainly used express with a HTTP server listening on one port. I'm currently working on an exercise project of making a fake money poker website. establish socket.I'm must say I'm very new to back end development, MessageList = document.querySelector( "ul") select relevant elements const form = document.querySelector( "form") Ĭonst input = document.querySelector( "input")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |