Skip to content

Commit 370bf54

Browse files
Incorporated the feedback and suggestions. Thanks
1 parent 18482d1 commit 370bf54

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

articles/azure-web-pubsub/concept-service-internals.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: vicancy
55
ms.author: lianwei
66
ms.service: azure-web-pubsub
77
ms.topic: conceptual
8-
ms.date: 08/09/2024
8+
ms.date: 08/21/2024
99
---
1010

1111
# Azure Web PubSub service internals
@@ -14,7 +14,7 @@ Azure Web PubSub Service provides an easy way to publish/subscribe messages usin
1414

1515
- Clients can be written in any language that has Websocket support.
1616
- Both text and binary messages are supported within one connection.
17-
- A simple protocol allows you to publish massages directly to each other.
17+
- A simple protocol allows clients to publish massages directly to each other.
1818
- The service manages the WebSocket connections for you.
1919

2020
## Terms
@@ -35,7 +35,7 @@ Workflow as shown in the above graph:
3535

3636
## Client protocol
3737

38-
A client connection connects to the `/client` endpoint of the service using [WebSocket protocol](https://tools.ietf.org/html/rfc6455). The WebSocket protocol provides full-duplex communication channels over a single TCP connection and follows all the standards of the IETF as RFC 6455 in 2011. Most languages have native support to start WebSocket connections.
38+
A client connection connects to the `/client` endpoint of the service using [WebSocket protocol](https://tools.ietf.org/html/rfc6455). The WebSocket protocol provides full-duplex communication channels over a single TCP connection and was standardized by the IETF as RFC 6455 in 2011. Most languages have native support to start WebSocket connections.
3939

4040
Our service supports two kinds of clients:
4141

@@ -64,7 +64,7 @@ A simple WebSocket client follows a client<->server architecture, as the followi
6464

6565
1. When the client starts a WebSocket handshake, the service tries to invoke the `connect` event handler for WebSocket handshake. Developers can use this handler to handle the WebSocket handshake, determine the subprotocol to use, authenticate the client, and join the client to groups.
6666
2. When the client is successfully connected, the service invokes a `connected` event handler. It works as a notification and doesn't block the client from sending messages. Developers can use this handler to do data storage and can respond with messages to the client. The service also pushes a `connected` event to all concerning event listeners, if any.
67-
3. When the client sends messages, the service triggers a `message` event to the event handler to handle the messages sent. This event is a general event containing the messages sent in a WebSocket frame. Your code needs to dispatch the messages inside this event handler. If the event handler returns nonsuccessful response code for, the service drops the client connection. The service also pushes a `message` event to all concerning event listeners, if any. If the service can't find any registered servers to receive the messages, the service also drops the connection.
67+
3. When the client sends messages, the service triggers a `message` event to the event handler. This event contains the messages sent in a WebSocket frame. Your code needs to dispatch the messages inside this event handler. If the event handler returns a nonsuccessful response code, the service drops the client connection. The service also pushes a `message` event to all concerned event listeners, if any. If the service can't find any registered servers to receive the messages, the service also drops the client connection.
6868
4. When the client disconnects, the service tries to trigger the `disconnected` event to the event handler once it detects the disconnect. The service also pushes a `disconnected` event to all concerning event listeners, if any.
6969

7070
#### Scenarios
@@ -183,8 +183,9 @@ Client events fall into two categories:
183183
Synchronous events block the client workflow.
184184
- `connect`: This event is for event handler only. When the client starts a WebSocket handshake, the event is triggered and developers can use `connect` event handler to handle the WebSocket handshake, determine the subprotocol to use, authenticate the client, and join the client to groups.
185185
- `message`: This event is triggered when a client sends a message.
186+
186187
- Asynchronous events (non-blocking)
187-
Asynchronous events don't block the client workflow. Instead, they act as some notification to the server. When such an event trigger fails, the service logs the error detail.
188+
Asynchronous events don't block the client workflow. Instead, they send a notification to the server. When such an event trigger fails, the service logs the error detail.
188189
- `connected`: This event is triggered when a client connects to the service successfully.
189190
- `disconnected`: This event is triggered when a client disconnected with the service.
190191
@@ -202,7 +203,7 @@ The following graph describes the workflow.
202203
203204
![Diagram showing the client authentication workflow.](./media/concept-service-internals/client-connect-workflow.png)
204205
205-
As you noticed when we describe the PubSub WebSocket clients, that a client can publish to other clients only when it's _authorized_ to. The `role`s of the client determines the _initial_ permissions the client have:
206+
A client can publish to other clients only when it's _authorized_ to. The `role`s of the client determines the _initial_ permissions the client has:
206207
207208
| Role | Permission |
208209
| ---------------------------------- | --------------------------------------------------- |
@@ -250,13 +251,14 @@ For now, we don't support [WebHook-Request-Rate](https://github.com/cloudevents/
250251
251252
#### Authentication/Authorization between service and webhook
252253
253-
To Establish secure authentication and authorization between your service and webhook, consider the following options and steps:
254+
To establish secure authentication and authorization between your service and webhook, consider the following options and steps:
254255
255256
- Anonymous mode
256257
- Simple authentication that `code` is provided through the configured Webhook URL.
257258
- Use Microsoft Entra authorization. For more information, see [how to use managed identity](howto-use-managed-identity.md) for details.
258-
- Step 1: Enable Identity for the Web PubSub service
259-
- Step 2: Select from existing Microsoft Entra application that stands for your webhook web app
259+
260+
1. Enable Identity for the Web PubSub service.
261+
1. Select from existing Microsoft Entra application that stands for your webhook web app.
260262
261263
### Connection manager
262264
@@ -294,7 +296,7 @@ Currently we support [**Event Hubs**](https://azure.microsoft.com/products/event
294296
295297
You need to register event listeners beforehand, so that when a client event is triggered, the service can push the event to the corresponding event listeners. See [this doc](./howto-develop-event-listener.md#configure-an-event-listener) for how to configure an event listener with an event hub endpoint.
296298
297-
You can configure multiple event listeners, and their order doesn't affect their functionality. If an event matches multiply listeners, the event is dispatched to all matching listeners. See the following diagram for an example. For example, if you configure four event listeners simultaneously, each listener receiving a match processes the event. A client event that matches with three of those listeners is sent to three listeners, leaving the rest one untouched.
299+
You can configure multiple event listeners. The order in which you configure them doesn't affect their functionality. If an event matches multiple listeners, the event is dispatched to all matching listeners. See the following diagram for an example. For example, if you configure four event listeners simultaneously, each listener that receives a match processes the event. A client event that matches with three of those listeners is sent to three listeners, with the remaining listener ignored.
298300

299301
:::image type="content" source="media/concept-service-internals/event-listener-data-flow.svg" alt-text="Event listener data flow diagram sample":::
300302

@@ -304,7 +306,7 @@ Web PubSub service delivers client events to event listeners using [CloudEvents
304306

305307
### Summary
306308

307-
You noticed that the _event handler role_ handles communication from the service to the server while _the manager role_ handles communication from the server to the service. Once you combine the two roles, the data flow between service and server looks similar to the following diagram using HTTP protocol.
309+
The _event handler role_ handles communication from the service to the server while _the manager role_ handles communication from the server to the service. Once you combine the two roles, the data flow between service and server looks similar to the following diagram using the HTTP protocol.
308310

309311
![Diagram showing the Web PubSub service bi-directional workflow.](./media/concept-service-internals/http-service-server.png)
310312

0 commit comments

Comments
 (0)