File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ $ cd socket.io
10
10
$ npm install
11
11
$ cd examples/chat
12
12
$ npm install
13
- $ node .
13
+ $ npm start
14
14
```
15
15
16
16
And point your browser to ` http://localhost:3000 ` . Optionally, specify
Original file line number Diff line number Diff line change 8
8
"license" : " BSD" ,
9
9
"dependencies" : {
10
10
"express" : " 4.13.4"
11
+ },
12
+ "scripts" : {
13
+ "start" : " node index.js"
11
14
}
12
15
}
Original file line number Diff line number Diff line change @@ -263,4 +263,20 @@ $(function() {
263
263
socket . on ( 'stop typing' , function ( data ) {
264
264
removeChatTyping ( data ) ;
265
265
} ) ;
266
+
267
+ socket . on ( 'disconnect' , function ( ) {
268
+ log ( 'you have been disconnected' ) ;
269
+ } ) ;
270
+
271
+ socket . on ( 'reconnect' , function ( ) {
272
+ log ( 'you have been reconnected' ) ;
273
+ if ( username ) {
274
+ socket . emit ( 'add user' , username ) ;
275
+ }
276
+ } ) ;
277
+
278
+ socket . on ( 'reconnect_error' , function ( ) {
279
+ log ( 'attempt to reconnect has failed' ) ;
280
+ } ) ;
281
+
266
282
} ) ;
You can’t perform that action at this time.
0 commit comments