Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket continues disconnecting on Chrome but not on FireFox if there is no update #848

Closed
ryancui92 opened this issue Mar 15, 2017 · 4 comments

Comments

@ryancui92
Copy link

Hi, I'm using webpack and webpack-dev-server to build my front-end project. Everything is ok except the websocket on Chrome. It disconnects when I have no new update on my files. While on Firefox, the same configuration and code, the websocket can have a ping-pong heartbeat to keep it alive.

When I first see this problem, I think maybe I open several tabs (includding pads or phones browser) so the socket has some problem. Then I test it only in one tab, here's the result.

Configuration and code

webpack.config.js

var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = {
  entry: './src/main.js',
  output: {
    path: '/dest',
    filename: 'bundle.js',
    publicPath: '/dest/'
  },
  module: {
    loaders: [{
      test: /\.vue$/,
      loader: 'vue-loader'
    }, {
      test: /\.js$/,
      exclude: /node_modules/,
      loader: 'babel-loader'
    }, {
      test: /\.css$/,
      use: ExtractTextPlugin.extract({
        use: 'css-loader'
      })
    }]
  },
  plugins: [
    new ExtractTextPlugin('styles.css')
  ]
}

webpack-dev-server command
webpack-dev-server --inline --hot --port 9090 --host 127.0.0.1

Chrome

log from console
image

If I do nothing to the source, the websocket will disconnect automatically.
image

FireFox

There is heartbeat, so websocket keeps connecting.
image

Version info

  • webpack: 2.2.1
  • webpack-dev-server: 2.4.1
  • Chrome: 57.0.2987.98
  • Firefox: 46.0.1
  • Platform: Windows 10

Do I make mistakes on some configurations? Or other reasons? Thanks.

@SpaceK33z
Copy link
Member

Please upgrade to the latest version, this should fix your issue.

@ryancui92
Copy link
Author

I upgraded to v2.4.2, but the problem still exists.

@steve-king
Copy link

Upgrading fixed it for me...thanks!

@ryancui92
Copy link
Author

Today I found the problem disappear...without any upgrade of webpack or webpack-dev-server but a Chrome upgrade and Windows 10 upgrade.

Chrome Version: 58.0.3029.81

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

No branches or pull requests

3 participants