log close event reason
This commit is contained in:
		| @ -164,14 +164,14 @@ const reconnect = (ws: WebSocket) => { | ||||
|   return createWebsocket(); | ||||
| }; | ||||
|  | ||||
| ws.on("close", () => { | ||||
| ws.on("close", (event: CloseEvent) => { | ||||
|   try { | ||||
|     if (reconnectAttempts < maxReconnectAttempts) { | ||||
|       const delay = baseDelay * Math.pow(1.5, reconnectAttempts); | ||||
|       console.log( | ||||
|         `WebSocket closed. Attempting to reconnect in ${ | ||||
|           delay / 1000 | ||||
|         } seconds...` | ||||
|         `WebSocket closed.\nReason: ${ | ||||
|           event.reason | ||||
|         }\nAttempting to reconnect in ${delay / 1000} seconds...` | ||||
|       ); | ||||
|  | ||||
|       setTimeout(() => { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user