elm-reactor icon indicating copy to clipboard operation
elm-reactor copied to clipboard

Provide config for server url

Open sporto opened this issue 10 years ago • 4 comments

I'm trying to integrate Elm with a Rails application. Elm-reactor runs on port 8000 and my Rails app in 3000. When embedding reactor it tries to connect to the sockets on the wrong port:

can't establish a connection to the server at ws://localhost:3000/socket?file=/client/One.elm.

I am using reactor as follows:

var app = Elm.fullscreenDebug('Two', '/client/Two.elm');

So we need some way to tell reactor where to find its server e.g.

var app = Elm.fullscreenDebug('Two', '/client/Two.elm', { host: 'localhost://8000'});

sporto avatar Jul 24 '15 01:07 sporto

Noted, thanks for filing.

vilterp avatar Jul 24 '15 02:07 vilterp

Maybe I'm misunderstanding the purpose here, but isn't elm-reactor --address=... --port=... doing what you want?

jvoigtlaender avatar Jul 24 '15 06:07 jvoigtlaender

@jvoigtlaender the reactor server might be running in port 8000 as set by --port, but the JS might be running in a different port entirely when embedded in another application.

Thus we need some way of telling the JS where to find the reactor server. Now it just assumes that the server is in the same host where the JS is running and tries to connect to web sockets there.

sporto avatar Jul 24 '15 09:07 sporto

Ah, yes, makes sense. Sorry for misunderstanding.

jvoigtlaender avatar Jul 24 '15 14:07 jvoigtlaender