We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It seems MySQL store wait for a little to get a session. It makes loss messages
Reproduction:
Result:
source:
var express = require("express"); var expressWs = require("express-ws"); var session = require("express-session"); var ExpressMySQLSession = require("express-mysql-session"); var MySQLStore = ExpressMySQLSession(session); var sessionStore = new MySQLStore({ host: 'localhost', user: 'root', database: 'express_session', password: 'password' }); var app = expressWs(express()).app; app.use(session({ secret: 'secret', saveUninitialized: false, resave: false, store: sessionStore })); app.get('/', function (req, res) { // store something to the session console.log(req.session.something); req.session.something = 'something'; // this client will reconnect automatically res.send("\n<script>\nfunction connect()\n{\n const ws = new WebSocket('ws://localhost:8000/api/ws');\n ws.onclose = ev=>{\n setTimeout(connect, 1000);\n };\n ws.onopen = ()=>{\n ws.send('data');\n };\n ws.onmessage = ev=>{\n console.log(ev.data);\n };\n}\nconnect();\n</script>\n"); }); app.ws('/api/ws', function (ws, req) { console.log('data will received'); ws.on('message', function (data) { console.log('data receivd:' + data); }); }); app.listen(8000);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It seems MySQL store wait for a little to get a session.
It makes loss messages
Reproduction:
Result:
source:
The text was updated successfully, but these errors were encountered: