From d06487708d59ed239ebdc54df8442002f76d0b52 Mon Sep 17 00:00:00 2001 From: Ben Randall Date: Mon, 18 May 2020 08:46:25 -0700 Subject: [PATCH] Update javascript-client.md (#18348) Fixing range for `Connect to a hub` section sample code. Current code shows this: ```js const connection = new signalR.HubConnectionBuilder() .withUrl("/chatHub") .configureLogging(signalR.LogLevel.Information) .build(); start(); /* this is here to show an alternative to start, with a then ``` New should show this: ```js const connection = new signalR.HubConnectionBuilder() .withUrl("/chatHub") .configureLogging(signalR.LogLevel.Information) .build(); async function start() { try { await connection.start(); console.log("connected"); } catch (err) { console.log(err); setTimeout(() => start(), 5000); } }; connection.onclose(async () => { await start(); }); // Start the connection. start(); /* this is here to show an alternative to start, with a then connection.start().then(() => console.log("connected")); */ /* this is here to show another alternative to start, with a catch connection.start().catch(err => console.error(err)); */ ``` --- aspnetcore/signalr/javascript-client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/signalr/javascript-client.md b/aspnetcore/signalr/javascript-client.md index 487fecda48..aa7750b32f 100644 --- a/aspnetcore/signalr/javascript-client.md +++ b/aspnetcore/signalr/javascript-client.md @@ -87,7 +87,7 @@ The client library is available on the following CDNs: The following code creates and starts a connection. The hub's name is case insensitive. -[!code-javascript[Call hub methods](javascript-client/sample/wwwroot/js/chat.js?range=9-13,43-45)] +[!code-javascript[Call hub methods](javascript-client/sample/wwwroot/js/chat.js?range=9-13,28-51)] ### Cross-origin connections