-
Notifications
You must be signed in to change notification settings - Fork 45
hot doesn't work when you have two or more websocket clients #93
Comments
/cc @shellscape |
I've been struggling with this all day long but I was able to fix the issue by removing these lines. From this PR it looks like these lines were added as part of a fix to prevent logging multiple times. With Seems like a fix might be to delete the aforementioned lines and have |
I had a look to see how |
@glenjamin |
I've just had a look, it looks like The reason I stopped doing this in |
Ok, I've now gone and read up on all the issues related to #47 and it turns out this is pretty complicated because there's a bunch of different ways that webpack bundles and chunks interact. Will need a bit more thinking and trying stuff out to be sure what can be done to resolve all the different scenarios. |
This issue is fixed in https://github.com/hedgepigdaniel/webpack-hmr-client |
@hedgepigdaniel oh cool, that looks neat - but I’m getting a 404 on the link with an explanation of the differnces |
thanks @glenjamin should be fixed now |
Oh right! I hadn’t realised it was a fork of hot client. I think contrib might be open to offers if someone maintaining it. I haven’t caught up with the people organising contrib recently, but it’s worth asking them |
Expected Behavior
When two/more websocket clients connected all should get messages (
hash
,ok
and etc).Actual Behavior
When you have two websocket clients, only first connected get information, second don't get nothing (i.e. hot doesn't work es expected) on connection.
Now
Code
Example from
webpack-serve
https://github.com/webpack-contrib/webpack-serve/blob/master/docs/addons/watch-content.config.jsHow Do We Reproduce?
WS
messages in dev tools.Why?
After run example above websocket client from example (https://github.com/webpack-contrib/webpack-serve/blob/master/docs/addons/watch-content.config.js#L25) connected first and websocket server send messages, when i open development site, websocket client from hot client (https://github.com/webpack-contrib/webpack-hot-client/blob/master/lib/client/socket.js#L18) connected to websocket server, but don't get messages due in
server.clients.size === 1
(https://github.com/webpack-contrib/webpack-hot-client/blob/master/lib/socket-server.js#L71) and hot doesn't work as expected.It is regression, because in
webpack-hot-client@3
all works fine:webpack-hot-client@3
(https://github.com/webpack-contrib/webpack-hot-client/blob/v3.0.0/index.js#L186)webpack-hot-client@4
(https://github.com/webpack-contrib/webpack-hot-client/blob/master/lib/socket-server.js#L71)Solution:
webpack-hot-client@3
net.Server
from (https://github.com/webpack-contrib/webpack-serve#listening) should contain websocker server (server.wss
property) to allow send messages without additional websocket clients (in some cases developers can use more when one websocket client, looks it is bad solution)The text was updated successfully, but these errors were encountered: