File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ for (var i = 0; i < USER_COUNTER; i++) {
1111 users . push ( {
1212 id : Faker . Helpers . randomNumber ( 1000000 ) ,
1313 age : Faker . Helpers . randomNumber ( 100 ) ,
14- name : Faker . Name . firstName ( )
14+ name : Faker . Name . firstName ( ) ,
15+ leaf : true
1516 } ) ;
1617}
1718console . log ( 'WebSocketServer :: Users table initialization done!' ) ;
@@ -41,6 +42,13 @@ wss.on('connection', function (ws) {
4142 data : users
4243 } ) ) ;
4344
45+ ws . send ( JSON . stringify ( {
46+ event : 'user/read' ,
47+ data : {
48+ children : users
49+ }
50+ } ) ) ;
51+
4452 ws . on ( 'message' , function ( json ) {
4553 var message = JSON . parse ( json ) ,
4654 event = message . event ;
@@ -61,7 +69,6 @@ wss.on('connection', function (ws) {
6169 } ) ) ;
6270 }
6371 else if ( event === 'read' ) {
64- console . log ( users ) ;
6572 ws . send ( JSON . stringify ( {
6673 event : 'read' ,
6774 data : users
You can’t perform that action at this time.
0 commit comments