Skip to content

Commit f631b16

Browse files
committed
Merge pull request #369 from chester1000/socketio-fix
fix(socketio): fallback for when `socket.handshake.address` is not provided
2 parents a613c6f + f6a1934 commit f631b16

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

Diff for: app/templates/server/config/_local.env.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
// This file should not be tracked by git.
77

88
module.exports = {
9-
SESSION_SECRET: "<%= _.slugify(appname) + '-secret' %>",
10-
FACEBOOK_ID: "app-id",
11-
FACEBOOK_SECRET: "secret",
12-
TWITTER_ID: "app-id",
13-
TWITTER_SECRET: "secret",
14-
GOOGLE_ID: "app-id",
15-
GOOGLE_SECRET: "secret",
9+
DOMAIN: 'http://localhost:9000',
10+
SESSION_SECRET: "<%= _.slugify(appname) + '-secret' %>",
11+
12+
FACEBOOK_ID: 'app-id',
13+
FACEBOOK_SECRET: 'secret',
14+
15+
TWITTER_ID: 'app-id',
16+
TWITTER_SECRET: 'secret',
17+
18+
GOOGLE_ID: 'app-id',
19+
GOOGLE_SECRET: 'secret',
20+
1621
// Control debug level for modules using visionmedia/debug
1722
// DEBUG: ""
1823
};

Diff for: app/templates/server/config/environment/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ var all = {
4444
facebook: {
4545
clientID: process.env.FACEBOOK_ID || 'id',
4646
clientSecret: process.env.FACEBOOK_SECRET || 'secret',
47-
callbackURL: 'http://localhost:9000/auth/facebook/callback'
47+
callbackURL: process.env.DOMAIN + '/auth/facebook/callback'
4848
},
4949
<% } %><% if(filters.twitterAuth) { %>
5050
twitter: {
5151
clientID: process.env.TWITTER_ID || 'id',
5252
clientSecret: process.env.TWITTER_SECRET || 'secret',
53-
callbackURL: 'http://localhost:9000/auth/twitter/callback'
53+
callbackURL: process.env.DOMAIN + '/auth/twitter/callback'
5454
},
5555
<% } %><% if(filters.googleAuth) { %>
5656
google: {
5757
clientID: process.env.GOOGLE_ID || 'id',
5858
clientSecret: process.env.GOOGLE_SECRET || 'secret',
59-
callbackURL: 'http://localhost:9000/auth/google/callback'
59+
callbackURL: process.env.DOMAIN + '/auth/google/callback'
6060
}<% } %>
6161
};
6262

Diff for: app/templates/server/config/socketio(socketio).js

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ module.exports = function (socketio) {
3838
// }));
3939

4040
socketio.on('connection', function (socket) {
41-
socket.address = socket.handshake.address.address + ':' +
42-
socket.handshake.address.port;
41+
socket.address = socket.handshake.address !== null ?
42+
socket.handshake.address.address + ':' + socket.handshake.address.port :
43+
process.env.DOMAIN;
44+
4345
socket.connectedAt = new Date();
4446

4547
// Call onDisconnect.

0 commit comments

Comments
 (0)