diff --git a/app/templates/_package.json b/app/templates/_package.json
index 11c7f3be5..d9865edee 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -25,7 +25,8 @@
"passport-google-oauth": "latest",<% } %>
"composable-middleware": "^0.3.0",
"connect-mongo": "^0.4.1"<% if(filters.socketio) { %>,
- "socket.io": "~1.0.6",
+ "socket.io": "^1.0.6",
+ "socket.io-client": "^1.0.6",
"socketio-jwt": "^2.0.2"<% } %>
},
"devDependencies": {
diff --git a/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee b/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee
index 630b9ef5f..3fef1c00e 100644
--- a/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee
+++ b/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee
@@ -7,9 +7,9 @@ angular.module '<%= scriptAppName %>'
# socket.io now auto-configures its connection when we omit a connection url
ioSocket = io '',
- 'reconnection limit': 10 * 1000
# Send auth token on connection, you will need to DI the Auth service above
# 'query': 'token=' + Auth.getToken()
+ path: '/socket.io-client'
socket = socketFactory ioSocket: ioSocket
@@ -64,4 +64,4 @@ angular.module '<%= scriptAppName %>'
###
unsyncUpdates: (modelName) ->
socket.removeAllListeners modelName + ':save'
- socket.removeAllListeners modelName + ':remove'
\ No newline at end of file
+ socket.removeAllListeners modelName + ':remove'
diff --git a/app/templates/client/components/socket(socketio)/socket.service.js b/app/templates/client/components/socket(socketio)/socket.service.js
index 28a2448fd..549f2d764 100644
--- a/app/templates/client/components/socket(socketio)/socket.service.js
+++ b/app/templates/client/components/socket(socketio)/socket.service.js
@@ -8,6 +8,7 @@ angular.module('<%= scriptAppName %>')
var ioSocket = io('', {
// Send auth token on connection, you will need to DI the Auth service above
// 'query': 'token=' + Auth.getToken()
+ path: '/socket.io-client'
});
var socket = socketFactory({
@@ -70,4 +71,4 @@ angular.module('<%= scriptAppName %>')
socket.removeAllListeners(modelName + ':remove');
}
};
- });
\ No newline at end of file
+ });
diff --git a/app/templates/client/index.html b/app/templates/client/index.html
index 28ea9ad52..7db523f66 100644
--- a/app/templates/client/index.html
+++ b/app/templates/client/index.html
@@ -44,10 +44,10 @@
-<% if(filters.socketio) { %> <% } %>
-
+
+ <% if(filters.socketio) { %><% } %>
diff --git a/app/templates/server/app.js b/app/templates/server/app.js
index 02593347b..1106df894 100644
--- a/app/templates/server/app.js
+++ b/app/templates/server/app.js
@@ -20,7 +20,10 @@ if(config.seedDB) { require('./config/seed'); }
<% } %>// Setup server
var app = express();
var server = require('http').createServer(app);<% if (filters.socketio) { %>
-var socketio = require('socket.io').listen(server);
+var socketio = require('socket.io')(server, {
+ serveClient: (config.env === 'production') ? false : true,
+ path: '/socket.io-client'
+});
require('./config/socketio')(socketio);<% } %>
require('./config/express')(app);
require('./routes')(app);
@@ -31,4 +34,4 @@ server.listen(config.port, config.ip, function () {
});
// Expose app
-exports = module.exports = app;
\ No newline at end of file
+exports = module.exports = app;