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

Use with existing Express/port #23

Open
GeoffreyPlitt opened this issue Sep 6, 2016 · 1 comment
Open

Use with existing Express/port #23

GeoffreyPlitt opened this issue Sep 6, 2016 · 1 comment

Comments

@GeoffreyPlitt
Copy link

I'd like to use this with an existing Express application that is already listening on a port.

Is it possible to do that, i.e. plug this in to a specific route on an existing web server, instead of listening on its own port?

@mikemintz
Copy link
Owner

Yes, see the bottom of the "involved example" on the readme

var app = express();
app.use('/', express.static('assets'));
var httpServer = http.createServer(app);
options.httpServer = httpServer;
options.httpPath = '/rethinkApi';

RethinkdbWebsocketServer.listen(options);
httpServer.listen(8000);

As long as you run RethinkdbWebsocketServer.listen with the httpServer set to the server from your existing express application, it should work.

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

2 participants