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
Copy file name to clipboardExpand all lines: articles/azure-web-pubsub/quickstarts-event-notifications-from-clients.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,18 @@ author: vicancy
5
5
ms.author: lianwei
6
6
ms.service: azure-web-pubsub
7
7
ms.topic: quickstart
8
-
ms.date: 03/13/2023
8
+
ms.date: 04/12/2023
9
9
---
10
10
11
11
# Event notifications from clients
12
12
13
13
## Intro
14
14
15
15
In the first three articles of "quickstarts", we learned two useful communication patterns using Web PubSub for real-time messaging at scale ***(million+)***.
16
-
-**Pub/Sub** among clients which frees your application server from the complexity of managing persistent connections
16
+
-**Pub/Sub** among clients that free your application server from the complexity of managing persistent connections
17
17
-**Push messages** to clients from your application server as soon as new data is available
18
18
19
-
In this quickstart guide, we will learn about the event system of Web PubSub so that your application server can react to events like when
19
+
In this quickstart guide, we learn about the event system of Web PubSub so that your application server can react to events like when
20
20
> [!div class="checklist"]
21
21
> * a client is `connected`
22
22
> * a client sends a `message`, which requires further processing
@@ -34,7 +34,7 @@ In this quickstart guide, we will learn about the event system of Web PubSub so
34
34
---
35
35
36
36
## Create the application
37
-
Web PubSub is a standalone service to your application server. While your application retains its role as a traditional HTTP server, Web PubSub takes care of the real-time message passing between your application server and the clients. We will first create the client program and then the server program.
37
+
Web PubSub is a standalone service to your application server. While your application retains its role as a traditional HTTP server, Web PubSub takes care of the real-time message passing between your application server and the clients. We first create the client program and then the server program.
app.listen(8080, () =>console.log('Server started, listening on port 8080'));
127
127
```
128
128
129
-
As configured in the code above, when a client connects with your Web PubSub resource, Web PubSub invokes the Webhook served by your application server at the path `/eventhandler`. Here, we simply print out the `userId` to the console when a user is connected.
129
+
As configured in the code above, when a client connects with your Web PubSub resource, Web PubSub invokes the Webhook served by your application server at the path `/eventhandler`. Here, we simply print the `userId` to the console when a user is connected.
130
130
131
131
---
132
132
133
133
## Expose localhost
134
-
If your run the program on your computer, it is running on `localhost` at port `8080`. For our purposes, it means your local express app cannot be reached on the internet. Consequently, Web PubSub can not invoke the Webhook served at the path `/eventhandler`.
134
+
If your run the program on your computer, it's running on `localhost` at port `8080`. For our purposes, it means your local express app can't be reached on the internet. So, Web PubSub can't invoke the Webhook served at the path `/eventhandler`.
135
135
136
136
What we need is to expose localhost to be accessible on the internet. There are several tools available for this.
137
137
> [!div class="checklist"]
@@ -148,18 +148,18 @@ You can download ngrok from https://ngrok.com/download
148
148
ngrok http 8080
149
149
```
150
150
#### 3. Make note of the generated URL
151
-
"ngrok" will output a URL like this `https://<domain-name>.ngrok.io`. Now your port `8080` is accessible on the internet.
151
+
"ngrok" outputs a URL like this `https://<domain-name>.ngrok.io`. Now your port `8080` is accessible on the internet.
152
152
153
153
---
154
154
155
155
## Set event handler on your Web PubSub resource
156
-
Now, we need to let your Web PubSub resource know about this Webhook URL. You can set the event handlers either from Azure Portal or Azure CLI.
156
+
Now, we need to let your Web PubSub resource know about this Webhook URL. You can set the event handlers either from Azure portal or Azure CLI.
157
157
158
158
# [Azure portal](#tab/portal)
159
-
1. Select **"Settings"** from the menu and click**"Add"**
159
+
1. Select **"Settings"** from the menu and select**"Add"**
160
160
:::image type="content" source="media/howto-develop-eventhandler/configure-event-handler_menu.png" alt-text="Screenshot of Azure Web PubSub Configure Event Handler - menu":::
161
161
162
-
1. Enter a hub name. For our purposes, enter "**myHub1**" and click "**Add**"
162
+
1. Enter a hub name. For our purposes, enter "**myHub1**" and select "**Add**"
163
163
164
164
1. In the event handler page, configure the following fields
165
165
:::image type="content" source="media/howto-develop-eventhandler/configure-event-handler_details.png" alt-text="Screenshot of Azure Web PubSub Configure Event Handler - details":::
@@ -238,7 +238,7 @@ let handler = new WebPubSubEventHandler(HUB_NAME, {
238
238
You should see both the `userId` and the `Received message: sending custom event!` printed to the console.
239
239
240
240
## Summary
241
-
This tutorial provides you with a basic idea of how the event system works in Web PubSub. In real-world applications, the event system can help you implement additional logic to process system and user generated events.
241
+
This tutorial provides you with a basic idea of how the event system works in Web PubSub. In real-world applications, the event system can help you implement more logic to process system and user generated events.
Copy file name to clipboardExpand all lines: articles/azure-web-pubsub/quickstarts-pubsub-among-clients.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
2
title: PubSub among clients
3
-
description: A quickstarts guide that shows to how to subsribe to messages in a group and send messages to a group without the involvement of a typical application server
3
+
description: A quickstarts guide that shows to how to subscribe to messages in a group and send messages to a group without the involvement of a typical application server
Note that the`server.sendToAll()` call sends a message to all connected clients in a hub.
349
+
The`server.sendToAll()` call sends a message to all connected clients in a hub.
350
350
351
351
#### Get the connection string
352
352
> [!Important]
353
353
> A connection string includes authorization information required for your application to access Web PubSub service. The access key inside the connection string is similar to a root password for your service.
354
354
355
-
For this quickstart guide, we will get it from Azure portal as shown below.
355
+
For this quickstart guide, we'll get it from Azure portal as shown below.
356
356

:::image type="content" source="media/quickstart-live-demo/push_messages_from_server.gif" alt-text="GIF of demonstrating an app server pushing data to connected client":::
371
371
372
-
Try running the same "subscribe" program in multiple command shells to simluate more than clients. As soon as the "publish" program is run, you should see messages being delivered in real-time to all these clients.
372
+
Try running the same "subscribe" program in multiple command shells to stimulate more than clients. As soon as the "publish" program is run, you should see messages being delivered in real-time to all these clients.
373
373
374
374
375
375
# [C#](#tab/csharp)
376
376
377
-
#### Ceate a project directory named `publisher` and install required dependencies:
377
+
#### Create a project directory named `publisher` and install required dependencies:
378
378
379
379
```bash
380
380
mkdir publisher
@@ -548,17 +548,17 @@ Message received: Hello World
548
548
---
549
549
550
550
## Summary
551
-
This quickstart demonstrates how easy it is to push messages from an application server to all connected clients in a hub. Additionally, Web PubSub allows you to push messages to
551
+
This quickstart demonstrates how easy it's to push messages from an application server to all connected clients in a hub. Additionally, Web PubSub allows you to push messages to
552
552
553
553
> [!div class="checklist"]
554
554
> * a subset of the clients in a **hub**
555
555
> * a particular group in a **hub**
556
556
> * a subset of clients in a **group**
557
557
558
-
These APIs enable a wealth of use cases, allowing developers to focus on unique business logic while be assured that Web PubSub offers **low latency (<100ms)**, **high availability** and **massive scale (million+ simultanenous connections)**.
558
+
These APIs enable a wealth of use cases, allowing developers to focus on unique business logic while be assured that Web PubSub offers **low latency (<100ms)**, **high availability** and **massive scale (million+ simultaneous connections)**.
559
559
560
560
## Next steps
561
-
In the next step, we will explore how to work with the event system of Web PubSub, necessary to build complete web applications.
561
+
In the next step, we'll explore how to work with the event system of Web PubSub, necessary to build complete web applications.
562
562
563
563
> [!div class="nextstepaction"]
564
564
> [Event notifications from clients](./quickstarts-event-notifications-from-clients.md)
0 commit comments