remix: Cannot run `remix run` on multiple apps at once

Because the port used by the WebSocket server is hard-coded, there’s currently no way to concurrently run dev for two Remix apps at once.

https://github.com/remix-run/remix/blob/c1821e4f2c7e844f3b7462bbd6ae7711479c1c7d/packages/remix-dev/cli/commands.ts#L52

The run and watch commands would need to be updated to accept an alternative argument to set the WebSocket’s server port. It would be nice if we could also pass these as command line arguments as needed.

# easily override either the port passed to @remix-run/serve or the watch command
# bikeshed the APIs, obviously!
$ remix run --port 3030 --socket-port 3002

Thoughts?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Closing as #2456 is merged now

that didn’t fix it 😢

It’d also be nice if instead of just dropping the process, Remix could be smart and just look for another port if the default/configured port is in use

This would be really useful so you don’t need to care about that at all

Another problem arises if you are working under https. ~Cannot open non-secure sockets (ws)~ EDIT: I was wrong, opening the port it does create a ws.

I was trying to monkey-patch the LiveReload component, but currently struggling with a solution that works both server and client side.

A possible solution could be:

let ws = new WebSocket("${window.location.protocol === 'https' ? 'wss' : 'ws'}://${window.location.hostname}:${port}/socket");

But don’t know/understand internals very well, so I don’t get the reason because LiveReload is loaded even server side.