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

Using appmetrics-dash with existing socket.io connection #109

Closed
Kristina-Ribacionkaite opened this issue Sep 4, 2017 · 6 comments
Closed

Comments

@Kristina-Ribacionkaite
Copy link

Passing server to monitor options results in Error during websocket handshake: Unexpected response code: 400. Without server option socket.io client and backend connects fine, but it creates new http server with default port 3001.
Is there a way to keep existing socket.io connection without creating a new server?
We are using node 6, express ^4 and socket.io and socket.io-client 1.7.3.

@tobespc
Copy link
Member

tobespc commented Sep 4, 2017

@Kristina-Ribacionkaite How are you passing the server options ?

You should be able to just put the following in your code to use the existing server

var dash = require('appmetrics-dash');
dash.attach();

Make sure you add this before you require any servers

@Kristina-Ribacionkaite
Copy link
Author

@tobespc we are using dash.monitor()

const appm = require('appmetrics');
const dash = require('appmetrics-dash');

dash.monitor({ server: ourAwesomeServer, appmetrics: appm });

Where ourAwesomeServer is our http server.

@tobespc
Copy link
Member

tobespc commented Sep 4, 2017

@Kristina-Ribacionkaite ok, can you replace those three lines with these 2 please

var dash = require('appmetrics-dash');
dash.attach();

make sure your put those lines before you define your ourAwesomeServer

@noxxious
Copy link
Contributor

noxxious commented Jan 6, 2018

Hi, the problem here is actually that appmetrics-dash will use the default socket.io listening path (/socket.io), which is wrong as most of the client applications due that. The proper way would be listen to a different (appmetrics-dash specific path). I've created the PR #136

@mrausch
Copy link

mrausch commented Feb 13, 2018

+1 for accepting PR #136
I have an application that already uses socket.io and I cannot use appmetrics-dash with that application.

@noxxious
Copy link
Contributor

@mrausch, you still can, but your application has to be configured to use non-default socket.io path unfortunately.

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

5 participants