You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -366,32 +332,30 @@ Now let's create a web application using the `json.webpubsub.azure.v1` subprotoc
366
332
367
333
```html
368
334
<html>
369
-
370
-
<body>
371
-
<div id="output"></div>
372
-
<script>
373
-
(async function () {
374
-
let res = await fetch('/negotiate')
375
-
let data = await res.json();
376
-
let ws = new WebSocket(data.url, 'json.webpubsub.azure.v1');
377
-
ws.onopen = () => {
378
-
console.log('connected');
379
-
};
380
-
381
-
let output = document.querySelector('#output');
382
-
ws.onmessage = event => {
383
-
let d = document.createElement('p');
384
-
d.innerText = event.data;
385
-
output.appendChild(d);
386
-
};
387
-
})();
388
-
</script>
389
-
</body>
390
-
391
-
</html>
335
+
<body>
336
+
<div id="output"></div>
337
+
<script>
338
+
(async function () {
339
+
let res = await fetch('/negotiate')
340
+
let data = await res.json();
341
+
let ws = new WebSocket(data.url, 'json.webpubsub.azure.v1');
342
+
ws.onopen = () => {
343
+
console.log('connected');
344
+
};
345
+
346
+
let output = document.querySelector('#output');
347
+
ws.onmessage = event => {
348
+
let d = document.createElement('p');
349
+
d.innerText = event.data;
350
+
output.appendChild(d);
351
+
};
352
+
})();
353
+
</script>
354
+
</body>
355
+
</html>
392
356
```
393
357
394
-
It just connects to the service and print any message received to the page. The main change is that we specify the subprotocol when creating the WebSocket connection.
358
+
The code above connects to the service and print any message received to the page. The main change is that we specify the subprotocol when creating the WebSocket connection.
0 commit comments