Commit d064877
authored
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));
*/
```1 parent bd98a44 commit d064877
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
0 commit comments