From 11ec9af02700c2f70d8c3534c43d09e934ea4c79 Mon Sep 17 00:00:00 2001 From: John Cao Date: Tue, 28 Feb 2017 10:16:10 -0500 Subject: [PATCH 1/2] to avoid conflict of grabbing websocket port both the spring-websocket and Browsersync use websocket so they will grabbing the websocket port. the best way is to separate the Browsersync websocket port to a different one otherwise the spring-websocket will not work in the way as expected. this change requires BrowserSync version 2.8.1+ --- .../client/templates/angular/webpack/_webpack.dev.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/generators/client/templates/angular/webpack/_webpack.dev.js b/generators/client/templates/angular/webpack/_webpack.dev.js index eb92afd319dd..86889e99a3fd 100644 --- a/generators/client/templates/angular/webpack/_webpack.dev.js +++ b/generators/client/templates/angular/webpack/_webpack.dev.js @@ -56,7 +56,14 @@ module.exports = webpackMerge(commonConfig({ env: ENV }), { new BrowserSyncPlugin({ host: 'localhost', port: 9000, - proxy: 'http://localhost:9060' + proxy: { + target: 'http://localhost:9060' + <% if (websocket === 'spring-websocket') { %>, + // When your app also uses web sockets + // NOTE: requires 2.8.1 or above + ws: true + <% } %> + } }, { reload: false }), From f2cac554a1b1b9e377b27fae4782d3133fa1d0b5 Mon Sep 17 00:00:00 2001 From: John Cao Date: Wed, 1 Mar 2017 14:31:25 -0500 Subject: [PATCH 2/2] reformat 1. remove comment as the version used in the generator matches by default; 2. move the comma to a better position at the end of line. --- .../client/templates/angular/webpack/_webpack.dev.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/generators/client/templates/angular/webpack/_webpack.dev.js b/generators/client/templates/angular/webpack/_webpack.dev.js index 86889e99a3fd..74f7810109b3 100644 --- a/generators/client/templates/angular/webpack/_webpack.dev.js +++ b/generators/client/templates/angular/webpack/_webpack.dev.js @@ -57,12 +57,8 @@ module.exports = webpackMerge(commonConfig({ env: ENV }), { host: 'localhost', port: 9000, proxy: { - target: 'http://localhost:9060' - <% if (websocket === 'spring-websocket') { %>, - // When your app also uses web sockets - // NOTE: requires 2.8.1 or above - ws: true - <% } %> + target: 'http://localhost:9060'<% if (websocket === 'spring-websocket') { %>, + ws: true<% } %> } }, { reload: false