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();