Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Make it possible to share HTTP server (eg with koa) #114

Open
JasonWoof opened this issue May 13, 2020 · 0 comments
Open

Make it possible to share HTTP server (eg with koa) #114

JasonWoof opened this issue May 13, 2020 · 0 comments

Comments

@JasonWoof
Copy link

Thanks for this awesome module! I was able to get it working by configuring a static websockets port and creating another port-forward in my docker-compose. This feature request is to make it possible for koa-webpack to configure webpack-hot-client to attach its websockets to koa's existing http server. so that an additional port is not needed.

  • Operating System / node / npm version: docker node:latest
  • webpack Version: 4.43.0
  • webpack-hot-client Version: 4.1.2

Your readme says: "If a server instance (eg. Express or Koa) is provided, the WebSocket server will attempt to attach to the server instance instead of using a separate port."

Please document how to do this. I tried the obvious things like passing in the http server and passing in the koa instance.

I also spent some time looking at your source code... it doesn't look like this feature exists.

I would very much like the websockets to use the http.createServer() that koa uses, so I don't have to configure it to use a static port and forward another port out of docker.

If I pass in an http.createServer() object then your module calls .listen() on it:

server.listen(port.server, host.server);

which makes it so koa can't call .listen() on it. So this doesn't achieve sharing between webpack-hot-client and koa.

I was going to put a feature request into koa-webpack, but I don't think that webpack-hot-client makes it possible, so I'm writing here.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant