You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-signalr/signalr-quickstart-azure-functions-javascript.md
+41-30Lines changed: 41 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Azure SignalR Service serverless quickstart - Javascript
2
+
title: Azure SignalR Service serverless quickstart - JavaScript
3
3
description: A quickstart for using Azure SignalR Service and Azure Functions to create an App showing GitHub star count using JavaScript.
4
4
author: vicancy
5
5
ms.author: lianwei
@@ -9,9 +9,9 @@ ms.service: signalr
9
9
ms.devlang: javascript
10
10
ms.custom: devx-track-js, mode-api
11
11
---
12
-
# Quickstart: Create a serverless app with Azure Functions and SignalR Service using Javascript
12
+
# Quickstart: Create a serverless app with Azure Functions and SignalR Service using JavaScript
13
13
14
-
In this article, you'll use Azure SignalR Service, Azure Functions, and JavaScript to build a serverless application to broadcast messages to clients.
14
+
In this article, you use Azure SignalR Service, Azure Functions, and JavaScript to build a serverless application to broadcast messages to clients.
15
15
16
16
## Prerequisites
17
17
@@ -20,11 +20,11 @@ This quickstart can be run on macOS, Windows, or Linux.
20
20
| Prerequisite | Description |
21
21
| --- | --- |
22
22
| An Azure subscription |If you don't have a subscription, create an [Azure free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F)|
23
-
| A code editor | You'll need a code editor such as [Visual Studio Code](https://code.visualstudio.com/). |
23
+
| A code editor | You need a code editor such as [Visual Studio Code](https://code.visualstudio.com/). |
24
24
|[Azure Functions Core Tools](https://github.com/Azure/azure-functions-core-tools#installing)| Requires version 4.0.5611 or higher to run Node.js v4 programming model.|
25
25
|[Node.js LTS](https://nodejs.org/en/download/)| See supported node.js versions in the [Azure Functions JavaScript developer guide](../azure-functions/functions-reference-node.md#node-version).|
26
-
|[Azurite](../storage/common/storage-use-azurite.md)| SignalR binding needs Azure Storage. You can use a local storage emulator when a function is running locally. |
27
-
|[Azure CLI](/cli/azure/install-azure-cli)| Optionally, you can use the Azure CLI to create an Azure SignalR Service instance. |
26
+
|[Azurite](../storage/common/storage-use-azurite.md)| SignalR binding needs Azure Storage. You can use a local storage emulator when a function is running locally. |
27
+
| [Azure CLI](/cli/azure/install-azure-cli)| Optionally, you can use the Azure CLI to create an Azure SignalR Service instance.
28
28
29
29
## Create an Azure SignalR Service instance
30
30
@@ -39,7 +39,6 @@ Make sure you have Azure Functions Core Tools installed.
39
39
1. Run the Azure Functions `func init` command to initialize a new project.
@@ -51,7 +50,7 @@ After you initialize a project, you need to create functions. This project requi
51
50
-`negotiate`: Allows a client to get an access token.
52
51
-`broadcast`: Uses a time trigger to periodically broadcast messages to all clients.
53
52
54
-
When you run the `func new` command from the root directory of the project, the Azure Functions Core Tools creates the function source files storing them in a folder with the function name. You'll edit the files as necessary replacing the default code with the app code.
53
+
When you run the `func new` command from the root directory of the project, the Azure Functions Core Tools creates the function source files storing them in a folder with the function name. You edit the files as necessary replacing the default code with the app code.
55
54
56
55
### Create the index function
57
56
@@ -63,7 +62,7 @@ When you run the `func new` command from the root directory of the project, the
63
62
64
63
1. Edit *src/functions/httpTrigger.js* and replace the contents with the following json code:
### Add the SignalR Service connection string to the function app settings
102
+
### Setup Azure Storage
104
103
105
-
Azure Functions requires a storage account to work. You can install and run the [Azure Storage Emulator](../storage/common/storage-use-azurite.md). **Or** you can update the setting to use your real storage account with the following command:
104
+
Azure Functions requires a storage account to work. Choose either of the two following options:
Run the Azure Function app in the local environment:
133
145
134
146
```bash
135
147
func start
136
148
```
137
149
138
-
> [!NOTE]
139
-
> If you see an errors showing read errors on the blob storage, ensure the 'AzureWebJobsStorage' setting in the *local.settings.json* file is set to `UseDevelopmentStorage=true`.
140
-
141
150
After the Azure Function is running locally, go to `http://localhost:7071/api/index`. The page displays the current star count for the GitHub Azure/azure-signalr repository. When you star or unstar the repository in GitHub, you'll see the refreshed count every few seconds.
142
151
143
-
Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.md) or [let us know](https://aka.ms/asrs/qscsharp)
152
+
Having issues? Try the [troubleshooting guide](signalr-howto-troubleshoot-guide.md) or [let us know.](https://aka.ms/asrs/qscsharp)
You can get all code used in the article from [GitHub](https://github.com/aspnet/AzureSignalR-samples/tree/main/samples/QuickStartServerless/javascript/v4-programming-model).
158
+
You can get all code used in the article from GitHub repository:
0 commit comments