Skip to content

Commit 5c0720e

Browse files
committed
add Liangying's review suggestions
1 parent fb4a4f6 commit 5c0720e

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

articles/azure-web-pubsub/tutorial-pub-sub-messages.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Clients connect to the Azure Web PubSub service through the standard WebSocket p
9898
* The package [Websocket.Client](https://github.com/Marfusios/websocket-client) is a third-party package supporting WebSocket connections. You can use any API/library that supports WebSocket.
9999
* The SDK package `Azure.Messaging.WebPubSub` helps to generate the JWT token.
100100

101-
```console
101+
```bash
102102
mkdir subscriber
103103
cd subscriber
104104
dotnet new console
@@ -155,17 +155,17 @@ Clients connect to the Azure Web PubSub service through the standard WebSocket p
155155
156156
After the connection is established, your client receives messages through the WebSocket connection. The client uses `client.MessageReceived.Subscribe(msg => ...));` to listen for incoming messages.
157157
158-
1. Run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier:
158+
1. To start the subscriber, run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier:
159159
160-
```console
160+
```bash
161161
dotnet run <Web-PubSub-connection-string> "myHub1"
162162
```
163163
164164
# [JavaScript](#tab/javascript)
165165
166166
1. First, create a project directory named `subscriber` and install required dependencies:
167167
168-
```console
168+
```bash
169169
mkdir subscriber
170170
cd subscriber
171171
npm init -y
@@ -198,9 +198,9 @@ Clients connect to the Azure Web PubSub service through the standard WebSocket p
198198
199199
After the connection is established, your client receives messages through the WebSocket connection. The client uses `client.MessageReceived.Subscribe(msg => ...));` to listen for incoming messages.
200200
201-
1. Run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier. If you are using Windows, you can use `set` instead of `export`.
201+
1. Run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier. If you are using Windows command shell, you can use `set` instead of `export`.
202202
203-
```console
203+
```bash
204204
export WebPubSubConnectionString=<Web-PubSub-connection-string>
205205
node subscribe.js
206206
```
@@ -209,7 +209,7 @@ Clients connect to the Azure Web PubSub service through the standard WebSocket p
209209
210210
1. First, create a project directory named `subscriber` and install required dependencies:
211211
212-
```console
212+
```bash
213213
mkdir subscriber
214214
cd subscriber
215215
# Create venv
@@ -263,9 +263,9 @@ Clients connect to the Azure Web PubSub service through the standard WebSocket p
263263
264264
After the connection is established, your client will receive messages through the WebSocket connection. Use `await ws.recv()` to listen for incoming messages.
265265
266-
1. Run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier:
266+
1. Run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier:
267267
268-
```console
268+
```bash
269269
python subscribe.py <Web-PubSub-connection-string> "myHub1"
270270
```
271271
@@ -280,7 +280,7 @@ Clients connect to the Azure Web PubSub service through the standard WebSocket p
280280
281281
1. Inside the `pubsub` directory, use Maven to create a new console app called `webpubsub-quickstart-subscriber`, then go to the *webpubsub-quickstart-subscriber* directory:
282282
283-
```console
283+
```bash
284284
mvn archetype:generate --define interactiveMode=n --define groupId=com.webpubsub.quickstart --define artifactId=webpubsub-quickstart-subscriber --define archetypeArtifactId=maven-archetype-quickstart --define archetypeVersion=1.4
285285
cd webpubsub-quickstart-subscriber
286286
```
@@ -378,10 +378,10 @@ Clients connect to the Azure Web PubSub service through the standard WebSocket p
378378
379379
After connection is established, your client will receive messages through the WebSocket connection. Use `onMessage(String message)` to listen for incoming messages.
380380
381-
1. Navigate to the *webpubsub-quickstart-subscriber* directory and run the app with following command:
381+
1. To start the subscriber app, go to the *webpubsub-quickstart-subscriber* directory and run the following command. Replace `<Web-PubSub-connection-string>` with the connection string you copied earlier.
382382
383-
```console
384-
mvn compile & mvn package & mvn exec:java -Dexec.mainClass="com.webpubsub.quickstart.App" -Dexec.cleanupDaemonThreads=false -Dexec.args="$connection_string 'myHub1'"
383+
```bash
384+
mvn compile & mvn package & mvn exec:java -Dexec.mainClass="com.webpubsub.quickstart.App" -Dexec.cleanupDaemonThreads=false -Dexec.args="<Web-PubSub-connection-string> 'myHub1'"
385385
```
386386
387387
---
@@ -394,7 +394,7 @@ Create a publisher using the Azure Web PubSub SDK to publish a message to the co
394394
395395
1. First, create a project directory named `publisher` and install required dependencies:
396396
397-
```console
397+
```bash
398398
mkdir publisher
399399
cd publisher
400400
dotnet new console
@@ -433,23 +433,23 @@ Create a publisher using the Azure Web PubSub SDK to publish a message to the co
433433
434434
The `SendToAllAsync()` call simply sends a message to all connected clients in the hub.
435435
436-
1. Send a message by running the command:
436+
1. Send a message by running the following command. Replace `<Web-PubSub-connection-string>` with the connection string you copied earlier.
437437
438-
```console
439-
dotnet run $connection_string "myHub1" "Hello World"
438+
```bash
439+
dotnet run <Web-PubSub-connection-string> "myHub1" "Hello World"
440440
```
441441
442-
1. Check the command shell of the previous subscriber to see that it received the message:
442+
1. Check the command shell of the subscriber to see that it received the message:
443443
444-
```text
444+
```console
445445
Message received: Hello World
446446
```
447447
448448
# [JavaScript](#tab/javascript)
449449
450450
1. First, create a project directory named `publisher` and install required dependencies:
451451
452-
```console
452+
```bash
453453
mkdir publisher
454454
cd publisher
455455
npm init -y
@@ -471,14 +471,14 @@ Create a publisher using the Azure Web PubSub SDK to publish a message to the co
471471
472472
The `service.sendToAll()` call simply sends a message to all connected clients in a hub.
473473
474-
1. Send a message by running the command. If you are using Windows, you can use `set` instead of `export`.
474+
1. To send a message, run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier. If you are using Windows command shell, you can use `set` instead of `export`.
475475
476-
```console
477-
export WebPubSubConnectionString=$connection_string
476+
```bash
477+
export WebPubSubConnectionString=<Web-PubSub-connection-string>
478478
node publish "Hello World"
479479
```
480480
481-
1. You can see that the previous subscriber received the message:
481+
1. You can see that the subscriber received the message:
482482
483483
```console
484484
Message received: Hello World
@@ -488,7 +488,7 @@ Create a publisher using the Azure Web PubSub SDK to publish a message to the co
488488
489489
1. First, create a project directory named `publisher` and install required dependencies:
490490
491-
```console
491+
```bash
492492
mkdir publisher
493493
cd publisher
494494
# Create venv
@@ -523,23 +523,23 @@ Create a publisher using the Azure Web PubSub SDK to publish a message to the co
523523
524524
The `send_to_all()` send the message to all connected clients in a hub.
525525
526-
1. Run the following command:
526+
1. To send a message, run the following command replacing `<Web-PubSub-connection-string>` with the connection string you copied earlier.
527527
528-
```console
529-
python publish.py $connection_string "myHub1" "Hello World"
528+
```bash
529+
python publish.py <Web-PubSub-connection-string> "myHub1" "Hello World"
530530
```
531531
532532
1. Check the previous command shell to that the subscriber received the message:
533533
534-
```text
534+
```console
535535
Received message: Hello World
536536
```
537537
538538
# [Java](#tab/java)
539539
540540
1. Go to the `pubsub` directory. Use Maven to create a publisher console app `webpubsub-quickstart-publisher` and go to the *webpubsub-quickstart-publisher* directory:
541541
542-
```console
542+
```bash
543543
mvn archetype:generate --define interactiveMode=n --define groupId=com.webpubsub.quickstart --define artifactId=webpubsub-quickstart-publisher --define archetypeArtifactId=maven-archetype-quickstart --define archetypeVersion=1.4
544544
cd webpubsub-quickstart-publisher
545545
```
@@ -588,15 +588,15 @@ Create a publisher using the Azure Web PubSub SDK to publish a message to the co
588588
589589
The `sendToAll()` call sends a message to all connected clients in a hub.
590590
591-
1. Go to the *webpubsub-quickstart-publisher* directory and run the project using the following command:
591+
1. To send a message, go to the *webpubsub-quickstart-publisher* directory and run the project using the following command. Replace the `<Web-PubSub-connection-string>` with the connection string you copied earlier.
592592
593-
```console
594-
mvn compile & mvn package & mvn exec:java -Dexec.mainClass="com.webpubsub.quickstart.App" -Dexec.cleanupDaemonThreads=false -Dexec.args="$connection_string 'myHub1' 'Hello World'"
593+
```bash
594+
mvn compile & mvn package & mvn exec:java -Dexec.mainClass="com.webpubsub.quickstart.App" -Dexec.cleanupDaemonThreads=false -Dexec.args="<Web-PubSub-connection-string> 'myHub1' 'Hello World'"
595595
```
596596
597-
1. You can see that the previous subscriber received the message:
597+
1. You can see that the subscriber received the message:
598598
599-
```text
599+
```console
600600
Message received: Hello World
601601
```
602602

0 commit comments

Comments
 (0)