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/socketio-serverless-protocol.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,17 +45,17 @@ Explanations of the previous sample:
45
45
46
46
When a client attempts to connect to the service, the process is divided into two distinct steps: establishing an Engine.IO (physical) connection and connecting to a namespace, which is referred to as a socket in Socket.IO terminology. The authentication process differs between these two steps:
47
47
48
-
1.**Engine.IO connection**: During this step, the service authenticates the client using an access token to determine whether to accept the connection. If the corresponding hub is configured to allow anonymous mode, the Engine.IO connection can proceed without validating the access token. However, for security reasons, it's recommended to disable anonymous mode in production environments.
48
+
1.**Engine.IO connection**: During this step, the service authenticates the client using an access token to determine whether to accept the connection. If the corresponding hub is configured to allow anonymous mode, the Engine.IO connection can proceed without validating the access token. However, for security reasons, we recommend to disable anonymous mode in production environments.
49
49
50
-
- The Engine.IO connection url follow the format as shown below. But in most cases, it should be handled by Socket.IO client library.
50
+
- The Engine.IO connection url follows the format. But in most cases, it should be handled by Socket.IO client library.
- The details of access token can be found in [here](#authentication-details)
57
57
58
-
2. **Socket**: After the Engine.IO connection is successfully established, the client SDK sends a payload to connect to a namespace. Upon receiving the socket connect request, the service triggers a connect call to the event handler. The outcome of this step depends on the status code returned by the connect response: a 200 status code indicates that the socket is approved, while a 4xx or 5xx status code results in the socket being rejected.
58
+
2. **Socket**: After the Engine.IO connection is successfully established, the client SDK sends a payload to connect to a namespace. Once the service receives the socket connect request, the service triggers a connect call to the event handler. The outcome of this step depends on the status code returned by the connect response: a 200 status code indicates that the socket is approved, while a 4xx or 5xx status code results in the socket being rejected.
59
59
60
60
3. Once a socket is connected, the service triggers a connected call to the event handler. It's an asynchronized call to notify the event handler a socket is successfully connected.
61
61
@@ -85,7 +85,7 @@ Client disconnects from a namespace or the corresponding Engine.IO connection cl
85
85
86
86
## Authentication Details
87
87
88
-
The service uses bearer token to authenticate. There're two main scenario to use the token.
88
+
The service uses bearer token to authenticate. There are two main scenarios to use the token.
89
89
90
90
- Connect of Engine.IO connection. The following request is an example.
91
91
@@ -102,7 +102,7 @@ The service uses bearer token to authenticate. There're two main scenario to use
102
102
Authorization: Bearer <token>
103
103
```
104
104
105
-
The generation of token can also be devided into two categories: key based authenitcation or identity based authentication.
105
+
The generation of token can also be divided into two categories: key based authentication or identity based authentication.
106
106
107
107
### **Key based authentication**
108
108
@@ -139,7 +139,7 @@ The generation of token can also be devided into two categories: key based authe
# Quickstart: Build chat app with Azure Function in Socket.IO Serverless Mode (Preview)
14
13
15
-
In this artical, you will use samples to familiar with how to build a chat app using Web PubSub for Socket.IO in Serverless Mode with Azure Function online and use Identity based authentication to secure your app.
14
+
In this article, you'll learn how to build a chat app using Web PubSub for Socket.IO in Serverless Mode with Azure Functions. The tutorial will guide you through securing your app with identity-based authentication, while working online.
16
15
17
-
The project source uses the Bicep to deploy the infrastructure in Azure and Azure Function Core Tools to deploy the code to the Function App.
16
+
The project source uses Bicep to deploy the infrastructure on Azure, and Azure Functions Core Tools to deploy the code to the Function App.
18
17
19
18
## Prerequest
20
19
21
20
+ An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
cd ./sdk/webpubsub-socketio-extension/examples/chat-serverless-typescript
40
36
```
41
-
::: zone-end
42
37
43
38
## Deploy infrastructure
44
39
@@ -56,14 +51,14 @@ az deployment sub create -n "<deployment-name>" -l "<deployment-location>" --tem
56
51
57
52
-`<deployment-name>`: The name of the deployment.
58
53
-`<deployment-location>`: The location of the deployment metadata. Note it's not the location where resources deploy to.
59
-
-`<env-name>`: The name will be a part of the resource group name and resource name.
54
+
-`<env-name>`: The name is a part of the resource group name and resource name.
60
55
-`<location>`: The location of the resources.
61
56
62
57
### Review of the infrastructure
63
58
64
-
In the infrastructure release, we deploy an Azure Function App in consumption plan as well as the Monitor and Storage Account that required by the Function App. We also deploy a Web PubSub for Socket.IO resource in Serverless Mode.
59
+
In the infrastructure release, we deploy an Azure Function App in consumption plan and the Monitor and Storage Account that required by the Function App. We also deploy a Web PubSub for Socket.IO resource in Serverless Mode.
65
60
66
-
For the identity based authentication purpose, we deploye a user-assigned managed identity, assign it to both Function App and Socket.IO resource and grant it with some permissions:
61
+
For the identity based authentication purpose, we deploy a user-assigned managed identity, assign it to both Function App and Socket.IO resource and grant it with some permissions:
67
62
68
63
-**Storage Blob Data Owner role**: Access storage for Function App
69
64
-**Monitoring Metrics Publisher role**: Access monitor for Function App
@@ -102,7 +97,7 @@ We need to do two steps to deploy the sample app.
102
97
103
98
### Run Sample App
104
99
105
-
After the code is deployed, visit the website to try the sample:
100
+
After the code is deployd, visit the website to try the sample:
The connection string can be get by the azure cli command
300
+
The connection string can be obtained by the Azure CLI command
301
301
302
302
```azcli
303
303
az webpubsub key show -g <resource group> -n <resource name>
304
304
```
305
305
306
-
The output will contains `primaryConnectionString` and `secondaryConnectionString`, and either is available.
306
+
The output contains `primaryConnectionString` and `secondaryConnectionString`, and either is available.
307
307
308
308
### Setup tunnel
309
309
310
-
In serverless mode, the service uses webhooks to trigger the function. When running the app locally, a crucial problem is let the service be able to access your local function endpoint.
310
+
In serverless mode, the service uses webhooks to trigger the function. When you try to run the app locally, a crucial problem is let the service be able to access your local function endpoint.
311
311
312
-
An easiest way to achieve it is to use [Tunnel Tool](../azure-web-pubsub/howto-web-pubsub-tunnel-tool.md)
312
+
An easiest way to achieve it's to use [Tunnel Tool](../azure-web-pubsub/howto-web-pubsub-tunnel-tool.md)
313
313
314
314
1. Install Tunnel Tool:
315
315
@@ -338,7 +338,7 @@ And visit the webpage at `http://localhost:7071/api/index`.
338
338
:::image type="content" source="./media/socketio-serverless-tutorial/chatsample.png" alt-text="Screenshot of the serverless chat app.":::
339
339
340
340
## Next steps
341
-
Next, you can try to leverage Bicep to deploy the app online with identity-based authentication:
341
+
Next, you can try to use Bicep to deploy the app online with identity-based authentication:
342
342
343
343
> [!div class="nextstepaction"]
344
344
> [Quickstart: Build chat app with Azure Function in Socket.IO Serverless Mode](./socketio-serverless-quickstart.md)
0 commit comments