@@ -89,6 +89,9 @@ func NewSocketServer(params *chaincfg.Params, txGetter txhelpers.RawTransactionG
89
89
return nil , err
90
90
}
91
91
92
+ // Set maximum number of connections.
93
+ server .SetMaxConnection (16384 )
94
+
92
95
// Each address subscription uses its own room, which has the same name as
93
96
// the address. The number of subscribers for each room is tracked.
94
97
addrs := roomSubscriptionCounter {
@@ -97,15 +100,17 @@ func NewSocketServer(params *chaincfg.Params, txGetter txhelpers.RawTransactionG
97
100
}
98
101
99
102
server .On ("connection" , func (so socketio.Socket ) {
100
- apiLog .Debug ("New socket.io connection" )
103
+ apiLog .Debugf ("New socket.io connection. %d clients are connected." ,
104
+ server .Count ())
101
105
// New connections automatically join the inv and sync rooms.
102
106
so .Join ("inv" )
103
107
so .Join ("sync" )
104
108
105
109
// Disconnection decrements or deletes the subscriber counter for each
106
110
// address room to which the client was subscribed.
107
111
so .On ("disconnection" , func () {
108
- apiLog .Debug ("socket.io client disconnected" )
112
+ apiLog .Debugf ("socket.io client disconnected. %d clients are connected." ,
113
+ server .Count ())
109
114
addrs .Lock ()
110
115
for _ , str := range so .Rooms () {
111
116
if c , ok := addrs .c [str ]; ok {
@@ -143,6 +148,9 @@ func NewSocketServer(params *chaincfg.Params, txGetter txhelpers.RawTransactionG
143
148
apiLog .Errorf ("Insight socket.io server error: %v" , err )
144
149
})
145
150
151
+ apiLog .Infof ("Started Insight socket.io server for up to %d clients." ,
152
+ server .GetMaxConnection ())
153
+
146
154
sockServ := SocketServer {
147
155
Server : * server ,
148
156
params : params ,
0 commit comments