Skip to content
This repository was archived by the owner on Jul 13, 2021. It is now read-only.
This repository was 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

Description

@JasonWoof

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions