Skip to content

Commit 3345994

Browse files
authored
Merge pull request #178688 from vicancy/lianwei/fix
sticky package version to avoid breaking changes break the samples
2 parents 143e45f + 9a5a97a commit 3345994

14 files changed

+108
-313
lines changed

.openpublishing.redirection.azure-web-pubsub.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
"source_path_from_root": "/articles/azure-web-pubsub/howto-troubleshoot-diagnostic-logs.md",
55
"redirect_url": "/azure/azure-web-pubsub/howto-troubleshoot-resource-logs",
66
"redirect_document_id": false
7+
},
8+
{
9+
"source_path_from_root": "/articles/azure-web-pubsub/reference-server-sdk-csharp.md",
10+
"redirect_url": "/dotnet/api/overview/azure/webpubsub/client",
11+
"redirect_document_id": false
12+
},
13+
{
14+
"source_path_from_root": "/articles/azure-web-pubsub/reference-server-sdk-java.md",
15+
"redirect_url": "/java/api/overview/azure/webpubsub/client",
16+
"redirect_document_id": false
717
}
818
]
919
}

articles/azure-web-pubsub/howto-develop-eventhandler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ update | Update hub settings for WebPubSub Service.
6161
Below is an example of creating 2 webhook URLs for hub `MyHub` of `MyWebPubSub` resource.
6262

6363
```azurecli-interactive
64-
az webpubsub hub create -n MyWebPubSub -g MyResourceGroup --hub-name MyHub --event-handler url-template="http://host.com" user-event-pattern="*" --event-handler url-template="http://host2.com" system-event="connected" system-event="disconnected" auth-type="ManagedIdentity" auth-resource="uri://myUri"
64+
az webpubsub hub create -n "MyWebPubSub" -g "MyResourceGroup" --hub-name "MyHub" --event-handler url-template="http://host.com" user-event-pattern="*" --event-handler url-template="http://host2.com" system-event="connected" system-event="disconnected" auth-type="ManagedIdentity" auth-resource="uri://myUri"
6565
```
6666

6767
## Next steps

articles/azure-web-pubsub/includes/cli-awps-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Open **another** CLI command, and you can broadcast messages to the clients:
1616
- Resource group name: **myResourceGroup**.
1717

1818
```azurecli-interactive
19-
az webpubsub service broadcast --name "<your-unique-resource-name>" --resource-group "myResourceGroup" --hub-name myHub1 --payload "Hello World"
19+
az webpubsub service broadcast --name "<your-unique-resource-name>" --resource-group "myResourceGroup" --hub-name "myHub1" --payload "Hello World"
2020
```
2121

2222
Switch back to the previous CLI command and you can see that the client received message:

articles/azure-web-pubsub/includes/cli-awps-update-event-handler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ Use the Azure CLI [az webpubsub hub create](/cli/azure/webpubsub/hub#az_webpubsu
1313
> Replace &lt;domain-name&gt; with the name ngrok printed.
1414
1515
```azurecli-interactive
16-
az webpubsub hub create -n "<your-unique-resource-name>" -g "myResourceGroup" --hub-name myHub1 --event-handler url-template="https://<domain-name>.ngrok.io/eventHandler" user-event-pattern="*" system-event="connected"
16+
az webpubsub hub create -n "<your-unique-resource-name>" -g "myResourceGroup" --hub-name "myHub1" --event-handler url-template="https://<domain-name>.ngrok.io/eventHandler" user-event-pattern="*" system-event="connected"
1717
```

articles/azure-web-pubsub/quickstart-use-sdk.md

Lines changed: 13 additions & 13 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: quickstart
8-
ms.date: 08/06/2021
8+
ms.date: 11/01/2021
99
---
1010

1111
# Quickstart: Publish messages using the service SDK for the Azure Web PubSub instance
@@ -69,7 +69,7 @@ Now let's use Azure Web PubSub SDK to publish a message to the connected client.
6969
mkdir publisher
7070
cd publisher
7171
dotnet new console
72-
dotnet add package Azure.Messaging.WebPubSub --prerelease
72+
dotnet add package Azure.Messaging.WebPubSub --version 1.0.0-beta.3
7373
```
7474

7575
2. Update the `Program.cs` file to use the `WebPubSubServiceClient` class and send messages to the clients.
@@ -125,31 +125,31 @@ Now let's use Azure Web PubSub SDK to publish a message to the connected client.
125125
mkdir publisher
126126
cd publisher
127127
npm init -y
128-
npm install --save @azure/web-pubsub
129-
128+
npm install --save @azure/[email protected]
130129
```
130+
131131
2. Now let's use Azure Web PubSub SDK to publish a message to the service. Create a `publish.js` file with the below code:
132132
133133
```javascript
134134
const { WebPubSubServiceClient } = require('@azure/web-pubsub');
135135
136-
if (process.argv.length !== 5) {
137-
console.log('Usage: node publish <connection-string> <hub-name> <message>');
138-
return 1;
136+
if (process.argv.length !== 3) {
137+
console.log('Usage: node publish <message>');
138+
return 1;
139139
}
140-
141-
let serviceClient = new WebPubSubServiceClient(process.argv[2], process.argv[3]);
142-
140+
const hub = "pubsub";
141+
let serviceClient = new WebPubSubServiceClient(process.env.WebPubSubConnectionString, hub);
143142
// by default it uses `application/json`, specify contentType as `text/plain` if you want plain-text
144-
serviceClient.sendToAll(process.argv[4], { contentType: "text/plain" });
143+
serviceClient.sendToAll(process.argv[2], { contentType: "text/plain" });
145144
```
146145
147146
The `sendToAll()` call simply sends a message to all connected clients in a hub.
148147
149148
3. Run the below command, replacing `<connection_string>` with the **ConnectionString** fetched in [previous step](#get-the-connectionstring-for-future-use):
150149
151150
```bash
152-
node publish "<connection_string>" "myHub1" "Hello World"
151+
export WebPubSubConnectionString="<connection-string>"
152+
node publish "Hello World"
153153
```
154154
155155
4. You can see that the previous CLI client received the message.
@@ -173,7 +173,7 @@ Now let's use Azure Web PubSub SDK to publish a message to the connected client.
173173
174174
# Or call .\env\Scripts\activate when you are using CMD
175175
176-
pip install azure-messaging-webpubsubservice
176+
pip install azure-messaging-webpubsubservice==1.0.0b1
177177
178178
```
179179
2. Now let's use Azure Web PubSub SDK to publish a message to the service. Create a `publish.py` file with the below code:

articles/azure-web-pubsub/reference-server-sdk-csharp.md

Lines changed: 0 additions & 103 deletions
This file was deleted.

articles/azure-web-pubsub/reference-server-sdk-java.md

Lines changed: 0 additions & 131 deletions
This file was deleted.

articles/azure-web-pubsub/reference-server-sdk-js.md

Lines changed: 1 addition & 1 deletion
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/26/2021
8+
ms.date: 11/01/2021
99
---
1010

1111
# JavaScript SDK for Azure Web PubSub

articles/azure-web-pubsub/reference-server-sdk-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You can use this library to:
2626
Install the package as follows:
2727

2828
```bash
29-
python -m pip install azure-messaging-webpubsubservice
29+
python -m pip install azure-messaging-webpubsubservice==1.0.0b1
3030
```
3131

3232
### Prerequisites

0 commit comments

Comments
 (0)