File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,12 @@ scServer.on('message', function (m) {
71
71
var socket = scClient . connect ( options ) ;
72
72
socket . once ( 'connect' , function ( ) {
73
73
if ( socket . connected ) {
74
+ // Subscribe to some events
75
+ socket . on ( 'event1' , function ( ) { } ) ;
76
+ socket . on ( 'event2' , function ( ) { } ) ;
77
+ socket . on ( 'event3' , function ( ) { } ) ;
78
+ socket . on ( 'event4' , function ( ) { } ) ;
79
+
74
80
console . log ( '#' + ++ socketCount + ' - Socket ' + socket . id + ' connected' ) ;
75
81
76
82
var interval = setInterval ( function ( ) {
@@ -162,7 +168,7 @@ scServer.on('message', function (m) {
162
168
console . log ( 'Store channels/events after session timeouts:' , util . inspect ( channels , { depth : 5 } ) ) ;
163
169
164
170
for ( var j in channels ) {
165
- var isChannelMapEmpty = JSON . stringify ( channels [ j ] ) . length < 70 ;
171
+ var isChannelMapEmpty = JSON . stringify ( channels [ j ] ) . length < 50 ;
166
172
assert ( isChannelMapEmpty , 'Channels/events were not cleaned up after sessions timed out' ) ;
167
173
}
168
174
console . log ( '[Success] Store channels/events were cleaned up after sessions timed out' ) ;
Original file line number Diff line number Diff line change 1
1
var fs = require ( 'fs' ) ;
2
2
var http = require ( 'http' ) ;
3
3
var getTestSocketPath = require ( './testsocketpath' ) . getTestSocketPath ;
4
+ var util = require ( 'util' ) ;
4
5
5
6
module . exports . run = function ( store ) {
6
7
console . log ( ' >> Store PID:' , process . pid ) ;
@@ -9,8 +10,13 @@ module.exports.run = function (store) {
9
10
10
11
// Send test data to index.js every second
11
12
var testDataInterval = setInterval ( function ( ) {
13
+ var socketChannelData = store . channelMap . get ( [ 'sockets' ] ) ;
14
+ var channels = [ ] ;
15
+ for ( var i in socketChannelData ) {
16
+ channels = channels . concat ( Object . keys ( socketChannelData [ i ] [ '__iocl' ] [ 'gle' ] ) ) ;
17
+ }
12
18
var sessionData = Object . keys ( store . dataMap . get ( [ '__iocl' , 'sed' ] ) || { } ) ;
13
- var channels = store . channelMap . getAll ( ) ;
19
+
14
20
var req = http . request ( {
15
21
socketPath : resultSocketPath ,
16
22
method : 'POST'
You can’t perform that action at this time.
0 commit comments