Skip to content

Commit a51500e

Browse files
authored
Some fix
1 parent 1bac8dc commit a51500e

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

articles/azure-web-pubsub/socketio-serverless-protocol.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ Explanations of the previous sample:
4545

4646
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:
4747

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.
4949

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.
5151

5252
```
5353
http://<service-endpoint>/clients/socketio/hubs/<hub-name>/?access_token=<access-token>
5454
```
5555
5656
- The details of access token can be found in [here](#authentication-details)
5757
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.
5959
6060
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.
6161
@@ -85,7 +85,7 @@ Client disconnects from a namespace or the corresponding Engine.IO connection cl
8585

8686
## Authentication Details
8787

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.
8989

9090
- Connect of Engine.IO connection. The following request is an example.
9191

@@ -102,7 +102,7 @@ The service uses bearer token to authenticate. There're two main scenario to use
102102
Authorization: Bearer <token>
103103
```
104104

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.
106106

107107
### **Key based authentication**
108108

@@ -139,7 +139,7 @@ The generation of token can also be devided into two categories: key based authe
139139
HMACSHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), <AccessKey>)
140140
```
141141

142-
The `AccessKey` can be get from the service Azure Portal or from the Azure Cli:
142+
The `AccessKey` can be obtained from the service Azure portal or from the Azure CLI:
143143

144144
```azcli
145145
az webpubsub key show -g <resource-group> -n <resource-name>

articles/azure-web-pubsub/socketio-serverless-quickstart.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,39 @@
11
---
22
title: 'Quickstart: Build chat app with Azure Function in Socket.IO Serverless Mode'
3-
description: In this artical, you will familiar with the samples of using Web PubSub for Socket.IO with Azure Function in Serverless Mode.
3+
description: In this article, you will familiar with the samples of using Web PubSub for Socket.IO with Azure Function in Serverless Mode.
44
keywords: Socket.IO, serverless, azure function, Socket.IO on Azure, multi-node Socket.IO, scaling Socket.IO, socketio, azure socketio
55
author: zackliu
66
ms.author: chenyl
77
ms.date: 09/01/2024
88
ms.service: azure-web-pubsub
99
ms.topic: tutorial
10-
zone_pivot_groups: programming-languages-set-functions
1110
---
1211

1312
# Quickstart: Build chat app with Azure Function in Socket.IO Serverless Mode (Preview)
1413

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.
1615

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.
1817

1918
## Prerequest
2019

2120
+ 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).
2221

23-
+ [Azure Functions Core Tools](functions-run-local.md#install-the-azure-functions-core-tools).
22+
+ [Azure Functions Core Tools](../azure-functions/functions-run-local.md).
2423

2524
+ [.NET 8.0 SDK](https://dotnet.microsoft.com/download)
2625

27-
::: zone pivot="programming-language-typescript"
2826
+ [Node.js 18](https://nodejs.org/)
29-
::: zone-end
3027

3128

3229
## Get the sample code
3330

34-
::: zone pivot="programming-language-typescript"
3531
Find the sample code: [Socket.IO Serverless Sample (TS)](https://github.com/Azure/azure-webpubsub/tree/main/sdk/webpubsub-socketio-extension/examples/chat-serverless-typescript)
3632

3733
```bash
3834
git clone https://github.com/Azure/azure-webpubsub.git
3935
cd ./sdk/webpubsub-socketio-extension/examples/chat-serverless-typescript
4036
```
41-
::: zone-end
4237

4338
## Deploy infrastructure
4439

@@ -56,14 +51,14 @@ az deployment sub create -n "<deployment-name>" -l "<deployment-location>" --tem
5651

5752
- `<deployment-name>`: The name of the deployment.
5853
- `<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.
6055
- `<location>`: The location of the resources.
6156

6257
### Review of the infrastructure
6358

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.
6560

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:
6762

6863
- **Storage Blob Data Owner role**: Access storage for Function App
6964
- **Monitoring Metrics Publisher role**: Access monitor for Function App
@@ -102,7 +97,7 @@ We need to do two steps to deploy the sample app.
10297

10398
### Run Sample App
10499

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:
106101

107102
```bash
108103
https://<function-endpoint>/api/index

articles/azure-web-pubsub/socketio-serverless-tutorial.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,19 +297,19 @@ func settings add WebPubSubForSocketIOConnectionString "<connection string>"
297297
az webpubsub hub create -n <resource name> -g <resource group> --hub-name hub --event-handler url-template="tunnel:///runtime/webhooks/socketio" user-event-pattern="*"
298298
```
299299

300-
The connection string can be get by the azure cli command
300+
The connection string can be obtained by the Azure CLI command
301301

302302
```azcli
303303
az webpubsub key show -g <resource group> -n <resource name>
304304
```
305305

306-
The output will contains `primaryConnectionString` and `secondaryConnectionString`, and either is available.
306+
The output contains `primaryConnectionString` and `secondaryConnectionString`, and either is available.
307307

308308
### Setup tunnel
309309

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.
311311

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)
313313

314314
1. Install Tunnel Tool:
315315

@@ -338,7 +338,7 @@ And visit the webpage at `http://localhost:7071/api/index`.
338338
:::image type="content" source="./media/socketio-serverless-tutorial/chatsample.png" alt-text="Screenshot of the serverless chat app.":::
339339

340340
## 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:
342342

343343
> [!div class="nextstepaction"]
344344
> [Quickstart: Build chat app with Azure Function in Socket.IO Serverless Mode](./socketio-serverless-quickstart.md)

0 commit comments

Comments
 (0)