| 251 | } |
| 252 | |
| 253 | protected onClose(event: CloseEvent): void { |
| 254 | if (this.abortReconnects) { |
| 255 | console.log('Socket Client - Connection closed.'); |
| 256 | if (this.killOnDisconnect) { |
| 257 | process.exit(process.pid); |
| 258 | } |
| 259 | if (this.onStateChange) { |
| 260 | this.onStateChange(false); |
| 261 | } |
| 262 | } else { |
| 263 | console.log(`SharedSocket Closed (Code: ${event.code}, Clean: ${event.wasClean}, Reason: "${event.reason}", URL: "${this.url}").`); |
| 264 | if (this.onStateChange) { |
| 265 | this.onStateChange(false); |
| 266 | } |
| 267 | this.reconnect(); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | // Static |
| 272 | |