create-elm-app
create-elm-app copied to clipboard
With proxy enabled, websocket requests in network tab every second
Hello. I have a question about these piling up in my development console (this is in firefox). A new couple of rows gets added every second:
I've added a proxy for my server application at port 3030. That server does have a wildcard endpoint for any route not recognized to send back build/index.html
because routing is to be done within the Elm application.
The proxy definitely works, I can get json bodies from my GET endpoints from my server app.
I attempted to create a manual proxy which would only forward '/api' requests and that seemed to work, but that feels dirty since now I have packages.config, lock file and packages_json folder. Also the project requires more setup (npm install
) for all developers and in the Dockerfile. I'd rather just stick with elm-app start
.
Any ideas how to resolve this spamming? Hot reloading is working at the moment, which I wouldn't expect because I think that's the job of these websocket requests.
I think I've solved this in an unconventional way. I use elmapp.config.js's setupProxy
in a way it wasn't meant to.
module.exports = {
setupProxy: (app, server) => {
this.proxy = [{
context: ['/api'],
target: 'http://localhost:3030'
}];
}
}
I'm going to go with that for now, but leave it the issue open.
EDIT: formatting