not working using express 4.16.1
reashetyrr opened this issue · 2 comments
reashetyrr commented
Hi,
ive tried to make the express-ws work with express 4.16.1
im using packages:
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"express": "~4.16.1",
"express-session": "^1.17.0",
"express-ws": "^4.0.0",
"glob": "^7.1.6",
"morgan": "~1.9.1",
"mysql": "^2.18.1",
"nunjucks": "^3.2.0",
"webdav": "^3.2.0"
the code ive tried is:
app.ws('/socket/media_files', function (ws, req) {
ws.on('message', async msg => {
const file_object = JSON.parse(msg);
ws.send(`data:${file_object.mime};base64,${await client.getFileContents(file_object.filename, {format: 'text'})}`);
})
});
app.ws('/socket', function(ws, req) {
ws.on('message', function(msg) {
ws.send(msg);
});
});```
ive also tried using the router but that also fails missirably, the issue i have is that i always get a 200 status request back
maruneko0 commented
Hi reashetyrr.
I had the same trouble.
Try the links below.
https://stackoverflow.com/questions/40362258/package-express-ws-doesnt-let-clients-connect
xtianus79 commented
@maruneko0 want to elaborate on this? like explain what it's doing?