Skip to content
New issue

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

Own Socket instance? #181

Open
Pajsen9263 opened this issue Nov 26, 2021 · 2 comments
Open

Own Socket instance? #181

Pajsen9263 opened this issue Nov 26, 2021 · 2 comments

Comments

@Pajsen9263
Copy link

How do I provide my own socket instance? I tried with const statusMonitor = require('express-status-monitor')({websocket: io}).
I've also tried with the port my server is on. (It's behind Nginx Proxy Manager, but my other socket stuff work).

@tahayk
Copy link
Contributor

tahayk commented Apr 2, 2022

@Pajsen9263
try this code:

const express = require('express');
const PORT = 3000;
const HOST = '127.0.0.1';

let app = express();
const server = app.listen(PORT, HOST, () => {
    console.log(`WS App listening on http://${HOST}:${PORT}`);
    console.log('Press Ctrl+C to quit.');
});
let io = require('socket.io')(server, {
    allowEIO3: true // this is required because ESM is using an old socket.io version
})
app.use(require('express-status-monitor')({
    websocket: io,
}));

@fedot199614
Copy link

@tahayk it is work for me thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants