File tree 4 files changed +13
-30
lines changed
client/components/socket(socketio)
4 files changed +13
-30
lines changed Original file line number Diff line number Diff line change 25
25
"passport-google-oauth" : " latest" ,<% } %>
26
26
"composable-middleware" : " ^0.3.0" ,
27
27
"connect-mongo" : " ^0.4.1" <% if(filters.socketio) { %>,
28
- "socket.io" : " ~0.9.16 " ,
28
+ "socket.io" : " ~1.0.6 " ,
29
29
"socketio-jwt" : " ^2.0.2" <% } %>
30
30
},
31
31
"devDependencies" : {
Original file line number Diff line number Diff line change 3
3
4
4
angular . module ( '<%= scriptAppName %>' )
5
5
. factory ( 'socket' , function ( socketFactory ) {
6
- var retryInterval = 5000 ;
7
- var retryTimer ;
8
6
9
- clearInterval ( retryTimer ) ;
10
-
11
- var ioSocket = io . connect ( '' , {
12
- 'force new connection' : true ,
13
-
14
- 'max reconnection attempts' : Infinity ,
15
-
16
- 'reconnection limit' : 10 * 1000 ,
17
-
18
- // Send auth token on connection
7
+ // socket.io now auto-configures its connection when we ommit a connection url
8
+ var ioSocket = io ( null , {
9
+ // Send auth token on connection, you will need to DI the Auth service above
19
10
// 'query': 'token=' + Auth.getToken()
20
11
} ) ;
21
12
22
- retryTimer = setInterval ( function ( ) {
23
- if ( ! ioSocket . socket . connected &&
24
- ! ioSocket . socket . connecting &&
25
- ! ioSocket . socket . reconnecting ) {
26
- ioSocket . connect ( ) ;
27
- }
28
- } , retryInterval ) ;
29
-
30
13
var socket = socketFactory ( {
31
14
ioSocket : ioSocket
32
15
} ) ;
Original file line number Diff line number Diff line change @@ -12,5 +12,7 @@ module.exports = {
12
12
TWITTER_ID : "app-id" ,
13
13
TWITTER_SECRET : "secret" ,
14
14
GOOGLE_ID : "app-id" ,
15
- GOOGLE_SECRET : "secret"
15
+ GOOGLE_SECRET : "secret" ,
16
+ // Control debug level for modules using visionmedia/debug
17
+ // DEBUG: ""
16
18
} ;
Original file line number Diff line number Diff line change @@ -22,24 +22,22 @@ function onConnect(socket) {
22
22
}
23
23
24
24
module . exports = function ( socketio ) {
25
- // The amount of detail that the server should output to the logger.
26
- // 0 - error
27
- // 1 - warn
28
- // 2 - info
29
- // 3 - debug
30
- socketio . set ( 'log level' , 2 ) ;
25
+ // socket.io (v1.x.x) is powered by debug.
26
+ // In order to see all the debug output, set DEBUG (in server/config/local.env.js) to including the desired scope.
27
+ //
28
+ // ex: DEBUG: "http*,socket.io:socket"
31
29
32
30
// We can authenticate socket.io users and access their token through socket.handshake.decoded_token
33
31
//
34
32
// 1. You will need to send the token in `client/components/socket/socket.service.js`
35
33
//
36
34
// 2. Require authentication here:
37
- // socketio.set('authorization', require('socketio-jwt').authorize({
35
+ // socketio.use( require('socketio-jwt').authorize({
38
36
// secret: config.secrets.session,
39
37
// handshake: true
40
38
// }));
41
39
42
- socketio . sockets . on ( 'connection' , function ( socket ) {
40
+ socketio . on ( 'connection' , function ( socket ) {
43
41
socket . address = socket . handshake . address . address + ':' +
44
42
socket . handshake . address . port ;
45
43
socket . connectedAt = new Date ( ) ;
You can’t perform that action at this time.
0 commit comments