-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49b2f90
commit 371af9d
Showing
25 changed files
with
503 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
# Used in most samples. Retrieve these values from a Communication Services instance | ||
# Used in most samples. Retrieve these values from a Communication Services resource | ||
# in the Azure Portal. | ||
COMMUNICATION_CONNECTION_STRING="" | ||
|
||
# Our tests assume that TEST_MODE is "playback" by default. You can | ||
# change it to "record" to generate new recordings, or "live" to bypass the recorder entirely. | ||
# TEST_MODE=record | ||
COMMUNICATION_CONNECTION_STRING="endpoint=https://<resource name>.communication.azure.net/;accessKey=<key>" | ||
COMMUNICATION_ENDPOINT="https://<resource name>.communication.azure.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
sdk/communication/communication-chat/samples/javascript/README.md
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
sdk/communication/communication-chat/samples/javascript/package.json
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
sdk/communication/communication-chat/samples/tsconfig.json
This file was deleted.
Oops, something went wrong.
68 changes: 0 additions & 68 deletions
68
sdk/communication/communication-chat/samples/typescript/README.md
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
sdk/communication/communication-chat/samples/typescript/package.json
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
sdk/communication/communication-chat/samples/v1/javascript/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
page_type: sample | ||
languages: | ||
- javascript | ||
products: | ||
- azure | ||
- azure-communication-services | ||
urlFragment: communication-chat-javascript | ||
--- | ||
|
||
# Azure Communication Services - Chat client library samples for JavaScript | ||
|
||
These sample programs show how to use the JavaScript client libraries for Azure Communication Services - Chat in some common scenarios. | ||
|
||
| **File Name** | **Description** | | ||
| --------------------------------------------------- | -------------------------------------------------------------------------- | | ||
| [messageOperations.js][messageoperations] | Perform message thread operations using the ChatThreadClient. | | ||
| [participantsOperations.js][participantsoperations] | Demonstrates how to use the ChatThreadClient to do participant operations. | | ||
| [threadOperations.js][threadoperations] | Perform thread operations using the ChatClient. | | ||
|
||
## Prerequisites | ||
|
||
The sample programs are compatible with Node.js >=12.0.0. | ||
|
||
You need [an Azure subscription][freesub] and the following Azure resources to run these sample programs: | ||
|
||
- [Azure Communication Services account][createinstance_azurecommunicationservicesaccount] | ||
|
||
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. | ||
|
||
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. | ||
|
||
## Setup | ||
|
||
To run the samples using the published version of the package: | ||
|
||
1. Install the dependencies using `npm`: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. | ||
|
||
3. Run whichever samples you like (note that some samples may require additional setup, see the table above): | ||
|
||
```bash | ||
node messageOperations.js | ||
``` | ||
|
||
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): | ||
|
||
```bash | ||
npx cross-env COMMUNICATION_CONNECTION_STRING="<communication connection string>" node messageOperations.js | ||
``` | ||
|
||
## Next Steps | ||
|
||
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. | ||
|
||
[messageoperations]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/communication/communication-chat/samples/v1/javascript/messageOperations.js | ||
[participantsoperations]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/communication/communication-chat/samples/v1/javascript/participantsOperations.js | ||
[threadoperations]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/communication/communication-chat/samples/v1/javascript/threadOperations.js | ||
[apiref]: https://docs.microsoft.com/javascript/api/@azure/communication-chat | ||
[freesub]: https://azure.microsoft.com/free/ | ||
[createinstance_azurecommunicationservicesaccount]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource | ||
[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/communication/communication-chat/README.md |
Oops, something went wrong.