From b56a63378600aabcd07d8184ead197314e5ea34d Mon Sep 17 00:00:00 2001 From: Esteban Luchsinger Date: Fri, 9 Jul 2021 23:58:46 +0200 Subject: [PATCH] Use the automatic SignalR reconnect feature (#22694) --- .../samples/3.x/SignalRChat/wwwroot/chat.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/aspnetcore/signalr/javascript-client/samples/3.x/SignalRChat/wwwroot/chat.js b/aspnetcore/signalr/javascript-client/samples/3.x/SignalRChat/wwwroot/chat.js index c80ce5cac4..1126890194 100644 --- a/aspnetcore/signalr/javascript-client/samples/3.x/SignalRChat/wwwroot/chat.js +++ b/aspnetcore/signalr/javascript-client/samples/3.x/SignalRChat/wwwroot/chat.js @@ -36,8 +36,14 @@ document.addEventListener("DOMContentLoaded", () => { setTimeout(start, 5000); } }; - - connection.onclose(start); + + connection.onclose(function (error) { + if (error) { + console.log(`Connection closed with error: ${error}`); + } else { + console.log("Connection closed."); + } + }); // Start the connection. start();