Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions samples/javascript/clientpubsub-client-sdk/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WPS_CONNECTION_STRING="<ConnectionString>"
36 changes: 36 additions & 0 deletions samples/javascript/clientpubsub-client-sdk/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Client pub-sub with `@azure/web-pubsub-client` and typescript

## Prerequisites

1. [Node.js](https://nodejs.org)
2. Create an Azure Web PubSub resource

## Overview

The sample demonstrate client pub-sub with `@azure/web-pubsub-client` library and typescript.

## Setup

Copy **Connection String** from **Keys** tab of the created Azure Web PubSub service, and open the `.env` file and replace the `"<ConnectionString>"` with the value of your **Connection String**.

![Connection String](./../../../docs/images/portal_conn.png)

1. Start Client subscriber

```bash
cd subscriber
npm install
npm run start
```

The preceding commands started a subscriber that subscribed to a group and print all message received from the group.

2. Start Client publisher

```bash
cd publisher
npm install
npm run start
```

The preceding commands started a publisher and you can type messages and press Enter to send. Then you can see these messages are transferred to the client subscriber in real-time.
Loading