fixing missed signalr js package refs (#15685)

* fixing missed signalr js package refs

* SignalR 3.0 doc patches (#15812)
pull/15433/head
Brady Gaster 2019-11-21 08:50:47 -08:00 committed by Scott Addie
parent 082f62f3c2
commit 99444e2aab
5 changed files with 106 additions and 47 deletions

View File

@ -5,7 +5,7 @@ description: Learn about the supported platforms for ASP.NET Core SignalR.
monikerRange: '>= aspnetcore-2.1'
ms.author: bradyg
ms.custom: mvc
ms.date: 11/12/2019
ms.date: 11/21/2019
no-loc: [SignalR]
uid: signalr/supported-platforms
---
@ -17,7 +17,7 @@ SignalR for ASP.NET Core supports any server platform that ASP.NET Core supports
## JavaScript client
The [JavaScript client](https://www.npmjs.com/package/@aspnet/signalr) runs on NodeJS 8 and later versions and the following browsers:
The [JavaScript client](xref:signalr/javascript-client) runs on NodeJS 8 and later versions and the following browsers:
| Browser | Version |
| ------------------------------- | --------------- |
@ -31,13 +31,13 @@ The [JavaScript client](https://www.npmjs.com/package/@aspnet/signalr) runs on N
## .NET client
The [.NET client](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR/) runs on any platform supported by ASP.NET Core. For example, [Xamarin developers can use SignalR](https://github.com/aspnet/Announcements/issues/305) for building Android apps using Xamarin.Android 8.4.0.1 and later and iOS apps using Xamarin.iOS 11.14.0.4 and later.
The [.NET client](xref:signalr/dotnet-client) runs on any platform supported by ASP.NET Core. For example, [Xamarin developers can use SignalR](https://github.com/aspnet/Announcements/issues/305) for building Android apps using Xamarin.Android 8.4.0.1 and later and iOS apps using Xamarin.iOS 11.14.0.4 and later.
If the server runs IIS, the WebSockets transport requires IIS 8.0 or later on Windows Server 2012 or later. Other transports are supported on all platforms.
## Java client
The [Java client](https://search.maven.org/artifact/com.microsoft.aspnet/signalr) supports Java 8 and later versions.
The [Java client](xref:signalr/java-client) supports Java 8 and later versions.
## Unsupported clients

View File

@ -4,7 +4,7 @@ author: bradygaster
description: Differences between SignalR and ASP.NET Core SignalR
monikerRange: '>= aspnetcore-2.1'
ms.author: bradyg
ms.date: 11/18/2019
ms.date: 11/21/2019
no-loc: [SignalR]
uid: signalr/version-differences
---
@ -15,14 +15,31 @@ ASP.NET Core SignalR isn't compatible with clients or servers for ASP.NET Signal
## How to identify the SignalR version
::: moniker range=">= aspnetcore-3.0"
| | ASP.NET SignalR | ASP.NET Core SignalR |
| -------------------- | --------------- | -------------------- |
| Server NuGet Package | [Microsoft.AspNet.SignalR](https://www.nuget.org/packages/Microsoft.AspNet.SignalR/) | [Microsoft.AspNetCore.App](https://www.nuget.org/packages/Microsoft.AspNetCore.App/) (.NET Core)<br>[Microsoft.AspNetCore.SignalR](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR/) (.NET Framework) |
| Client NuGet Packages | [Microsoft.AspNet.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNet.SignalR.Client/)<br>[Microsoft.AspNet.SignalR.JS](https://www.nuget.org/packages/Microsoft.AspNet.SignalR.JS/) | [Microsoft.AspNetCore.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/) |
| Client npm Package | [signalr](https://www.npmjs.com/package/signalr) | [@aspnet/signalr](https://www.npmjs.com/package/@aspnet/signalr) |
| Java Client | [GitHub Repository](https://github.com/SignalR/java-client) (deprecated) | Maven package [com.microsoft.signalr](https://search.maven.org/artifact/com.microsoft.signalr/signalr) |
| Server App Type | ASP.NET (System.Web) or OWIN Self-Host | ASP.NET Core |
| Supported Server Platforms | .NET Framework 4.5 or later | .NET Framework 4.6.1 or later<br>.NET Core 2.1 or later |
| Server NuGet package | [Microsoft.AspNet.SignalR](https://www.nuget.org/packages/Microsoft.AspNet.SignalR/) | None. Included in the [Microsoft.AspNetCore.App](xref:fundamentals/metapackage-app) shared framework. |
| Client NuGet packages | [Microsoft.AspNet.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNet.SignalR.Client/)<br>[Microsoft.AspNet.SignalR.JS](https://www.nuget.org/packages/Microsoft.AspNet.SignalR.JS/) | [Microsoft.AspNetCore.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/) |
| JavaScript client npm package | [signalr](https://www.npmjs.com/package/signalr) | [@microsoft/signalr](https://www.npmjs.com/package/@microsoft/signalr) |
| Java client | [GitHub Repository](https://github.com/SignalR/java-client) (deprecated) | Maven package [com.microsoft.signalr](https://search.maven.org/artifact/com.microsoft.signalr/signalr) |
| Server app type | ASP.NET (System.Web) or OWIN Self-Host | ASP.NET Core |
| Supported server platforms | .NET Framework 4.5 or later | .NET Core 3.0 or later |
::: moniker-end
::: moniker range="<= aspnetcore-2.2"
| | ASP.NET SignalR | ASP.NET Core SignalR |
| -------------------- | --------------- | -------------------- |
| Server NuGet package | [Microsoft.AspNet.SignalR](https://www.nuget.org/packages/Microsoft.AspNet.SignalR/) | [Microsoft.AspNetCore.App](https://www.nuget.org/packages/Microsoft.AspNetCore.App/) (.NET Core)<br>[Microsoft.AspNetCore.SignalR](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR/) (.NET Framework) |
| Client NuGet packages | [Microsoft.AspNet.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNet.SignalR.Client/)<br>[Microsoft.AspNet.SignalR.JS](https://www.nuget.org/packages/Microsoft.AspNet.SignalR.JS/) | [Microsoft.AspNetCore.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/) |
| JavaScript client npm package | [signalr](https://www.npmjs.com/package/signalr) | [@aspnet/signalr](https://www.npmjs.com/package/@aspnet/signalr) |
| Java client | [GitHub Repository](https://github.com/SignalR/java-client) (deprecated) | Maven package [com.microsoft.signalr](https://search.maven.org/artifact/com.microsoft.signalr/signalr) |
| Server app type | ASP.NET (System.Web) or OWIN Self-Host | ASP.NET Core |
| Supported server platforms | .NET Framework 4.5 or later | .NET Framework 4.6.1 or later<br>.NET Core 2.1 or later |
::: moniker-end
## Feature differences
@ -66,13 +83,13 @@ ASP.NET Core SignalR supports JSON, as well as a new binary protocol based on [M
### Transports
The Forever Frame transport is not supported in ASP.NET Core SignalR.
The Forever Frame transport isn't supported in ASP.NET Core SignalR.
## Differences on the server
The ASP.NET Core SignalR server-side libraries are included in the [Microsoft.AspNetCore.App metapackage](xref:fundamentals/metapackage-app) package that's part of the **ASP.NET Core Web Application** template for both Razor and MVC projects.
The ASP.NET Core SignalR server-side libraries are included in [Microsoft.AspNetCore.App](xref:fundamentals/metapackage-app), which is used in the **ASP.NET Core Web Application** template for both Razor and MVC projects.
ASP.NET Core SignalR is an ASP.NET Core middleware, so it must be configured by calling [AddSignalR](/dotnet/api/microsoft.extensions.dependencyinjection.signalrdependencyinjectionextensions.addsignalr) in `Startup.ConfigureServices`.
ASP.NET Core SignalR is an ASP.NET Core middleware. It must be configured by calling <xref:Microsoft.Extensions.DependencyInjection.SignalRDependencyInjectionExtensions.AddSignalR%2A> in `Startup.ConfigureServices`.
```csharp
services.AddSignalR()
@ -80,8 +97,7 @@ services.AddSignalR()
::: moniker range=">= aspnetcore-3.0"
To configure routing, map routes to hubs inside the [UseEndpoints](/dotnet/api/microsoft.aspnetcore.builder.endpointroutingapplicationbuilderextensions.useendpoints) method call in the `Startup.Configure` method.
To configure routing, map routes to hubs inside the <xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints%2A> method call in the `Startup.Configure` method.
```csharp
app.UseRouting();
@ -96,7 +112,7 @@ app.UseEndpoints(endpoints =>
::: moniker range="<= aspnetcore-2.2"
To configure routing, map routes to hubs inside the [UseSignalR](/dotnet/api/microsoft.aspnetcore.builder.signalrappbuilderextensions.usesignalr) method call in the `Startup.Configure` method.
To configure routing, map routes to hubs inside the <xref:Microsoft.AspNetCore.Builder.SignalRAppBuilderExtensions.UseSignalR%2A> method call in the `Startup.Configure` method.
```csharp
app.UseSignalR(routes =>
@ -109,7 +125,7 @@ app.UseSignalR(routes =>
### Sticky sessions
The scaleout model for ASP.NET SignalR allows clients to reconnect and send messages to any server in the farm. In ASP.NET Core SignalR, the client must interact with the same server for the duration of the connection. For scaleout using Redis, that means sticky sessions are required. For scaleout using [Azure SignalR Service](/azure/azure-signalr/), sticky sessions are not required because the service handles connections to clients.
The scaleout model for ASP.NET SignalR allows clients to reconnect and send messages to any server in the farm. In ASP.NET Core SignalR, the client must interact with the same server for the duration of the connection. For scaleout using Redis, that means sticky sessions are required. For scaleout using [Azure SignalR Service](/azure/azure-signalr/), sticky sessions aren't required because the service handles connections to clients.
### Single hub per connection
@ -121,7 +137,7 @@ ASP.NET Core SignalR now supports [streaming data](xref:signalr/streaming) from
### State
The ability to pass arbitrary state between clients and the hub (often called HubState) has been removed, as well as support for progress messages. There is no counterpart of hub proxies at the moment.
The ability to pass arbitrary state between clients and the hub (often called `HubState`) has been removed, as well as support for progress messages. There is no counterpart of hub proxies at the moment.
### PersistentConnection removal
@ -141,15 +157,30 @@ ASP.NET Core SignalR doesn't have support for `HubPipeline` modules.
The ASP.NET Core SignalR client is written in [TypeScript](https://www.typescriptlang.org/). You can write in JavaScript or TypeScript when using the [JavaScript client](xref:signalr/javascript-client).
### The JavaScript client is hosted at [npm](https://www.npmjs.com/)
### The JavaScript client is hosted at npm
In previous versions, the JavaScript client was obtained through a NuGet package in Visual Studio. For the Core versions, the [@aspnet/signalr](https://www.npmjs.com/package/@aspnet/signalr) npm package contains the JavaScript libraries. This package isn't included in the **ASP.NET Core Web Application** template. Use npm to obtain and install the `@aspnet/signalr` npm package.
::: moniker range=">= aspnetcore-3.0"
In ASP.NET versions, the JavaScript client was obtained through a NuGet package in Visual Studio. In the ASP.NET Core versions, the [@microsoft/signalr](https://www.npmjs.com/package/@microsoft/signalr) npm package contains the JavaScript libraries. This package isn't included in the **ASP.NET Core Web Application** template. Use npm to obtain and install the `@microsoft/signalr` npm package.
```console
npm init -y
npm install @microsoft/signalr
```
::: moniker-end
::: moniker range="<= aspnetcore-2.2"
In ASP.NET versions, the JavaScript client was obtained through a NuGet package in Visual Studio. In the ASP.NET Core versions, the [@aspnet/signalr](https://www.npmjs.com/package/@aspnet/signalr) npm package contains the JavaScript libraries. This package isn't included in the **ASP.NET Core Web Application** template. Use npm to obtain and install the `@aspnet/signalr` npm package.
```console
npm init -y
npm install @aspnet/signalr
```
::: moniker-end
### jQuery
The dependency on jQuery has been removed, however projects can still use jQuery.
@ -160,7 +191,23 @@ ASP.NET Core SignalR requires Microsoft Internet Explorer 11 or later (ASP.NET S
### JavaScript client method syntax
The JavaScript syntax has changed from the previous version of SignalR. Rather than using the `$connection` object, create a connection using the [HubConnectionBuilder](/javascript/api/%40aspnet/signalr/hubconnectionbuilder) API.
::: moniker range=">= aspnetcore-3.0"
The JavaScript syntax has changed from the ASP.NET version of SignalR. Rather than using the `$connection` object, create a connection using the [HubConnectionBuilder](/javascript/api/@aspnet/signalr/hubconnectionbuilder) API.
```javascript
const connection = new signalR.HubConnectionBuilder()
.withUrl("/hub")
.build();
```
Use the [on](/javascript/api/@microsoft/signalr/HubConnection#on) method to specify client methods that the hub can call.
::: moniker-end
::: moniker range="<= aspnetcore-2.2"
The JavaScript syntax has changed from the ASP.NET version of SignalR. Rather than using the `$connection` object, create a connection using the [HubConnectionBuilder](/javascript/api/@microsoft/signalr/hubconnectionbuilder) API.
```javascript
const connection = new signalR.HubConnectionBuilder()
@ -170,29 +217,41 @@ const connection = new signalR.HubConnectionBuilder()
Use the [on](/javascript/api/@aspnet/signalr/HubConnection#on) method to specify client methods that the hub can call.
::: moniker-end
```javascript
connection.on("ReceiveMessage", (user, message) => {
const msg = message.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
const encodedMsg = user + " says " + msg;
log(encodedMsg);
const encodedMsg = `${user} says ${msg}`;
console.log(encodedMsg);
});
```
After creating the client method, start the hub connection. Chain a [catch](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch) method to log or handle errors.
```javascript
connection.start().catch(err => console.error(err.toString()));
connection.start().catch(err => console.error(err));
```
### Hub proxies
Hub proxies are no longer automatically generated. Instead, the method name is passed into the [invoke](/javascript/api/%40aspnet/signalr/hubconnection#invoke) API as a string.
::: moniker range=">= aspnetcore-3.0"
Hub proxies are no longer automatically generated. Instead, the method name is passed into the [invoke](/javascript/api/@microsoft/signalr/hubconnection#invoke) API as a string.
::: moniker-end
::: moniker range="<= aspnetcore-2.2"
Hub proxies are no longer automatically generated. Instead, the method name is passed into the [invoke](/javascript/api/@aspnet/signalr/hubconnection#invoke) API as a string.
::: moniker-end
### .NET and other clients
The `Microsoft.AspNetCore.SignalR.Client` NuGet package contains the .NET client libraries for ASP.NET Core SignalR.
The [Microsoft.AspNetCore.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client) NuGet package contains the .NET client libraries for ASP.NET Core SignalR.
Use the [HubConnectionBuilder](/dotnet/api/microsoft.aspnetcore.signalr.client.hubconnectionbuilder) to create and build an instance of a connection to a hub.
Use the <xref:Microsoft.AspNetCore.SignalR.Client.HubConnectionBuilder> to create and build an instance of a connection to a hub.
```csharp
connection = new HubConnectionBuilder()

View File

@ -4,7 +4,7 @@ author: ssougnez
description: In this tutorial, you configure Webpack to bundle and build an ASP.NET Core SignalR web app whose client is written in TypeScript.
ms.author: bradyg
ms.custom: mvc
ms.date: 11/12/2019
ms.date: 11/21/2019
no-loc: [SignalR]
uid: tutorials/signalr-typescript-webpack
---
@ -191,10 +191,10 @@ The app currently displays a simple form to send messages. Nothing happens when
1. Execute the following command at the project root:
```console
npm install @aspnet/signalr
npm install @microsoft/signalr
```
The preceding command installs the [SignalR TypeScript client](https://www.npmjs.com/package/@aspnet/signalr), which allows the client to send messages to the server.
The preceding command installs the [SignalR TypeScript client](https://www.npmjs.com/package/@microsoft/signalr), which allows the client to send messages to the server.
1. Add the highlighted code to the *src/index.ts* file:
@ -426,10 +426,10 @@ The app currently displays a simple form to send messages. Nothing happens when
1. Execute the following command at the project root:
```console
npm install @aspnet/signalr
npm install @microsoft/signalr
```
The preceding command installs the [SignalR TypeScript client](https://www.npmjs.com/package/@aspnet/signalr), which allows the client to send messages to the server.
The preceding command installs the [SignalR TypeScript client](https://www.npmjs.com/package/@microsoft/signalr), which allows the client to send messages to the server.
1. Add the highlighted code to the *src/index.ts* file:

View File

@ -1,7 +1,7 @@
// This code exists only for inclusion in the associated doc.
// <snippet_IndexTsPhase2File>
import "./css/main.css";
import * as signalR from "@aspnet/signalr";
import * as signalR from "@microsoft/signalr";
const divMessages: HTMLDivElement = document.querySelector("#divMessages");
const tbMessage: HTMLInputElement = document.querySelector("#tbMessage");

View File

@ -4,7 +4,7 @@ author: bradygaster
description: In this tutorial, you create a chat app that uses ASP.NET Core SignalR.
ms.author: bradyg
ms.custom: mvc
ms.date: 11/12/2019
ms.date: 11/21/2019
no-loc: [SignalR]
uid: tutorials/signalr
@ -325,7 +325,7 @@ The SignalR server library is included in the `Microsoft.AspNetCore.App` metapac
* In the **Add Client-Side Library** dialog, for **Provider** select **unpkg**.
* For **Library**, enter `@aspnet/signalr@1`, and select the latest version that isn't preview.
* For **Library**, enter `@microsoft/signalr@3`, and select the latest version that isn't preview.
![Add Client-Side Library dialog - select library](signalr/_static/2.x/libman1.png)
@ -348,7 +348,7 @@ The SignalR server library is included in the `Microsoft.AspNetCore.App` metapac
* Run the following command to get the SignalR client library by using LibMan. You might have to wait a few seconds before seeing output.
```console
libman install @aspnet/signalr -p unpkg -d wwwroot/lib/signalr --files dist/browser/signalr.js --files dist/browser/signalr.min.js
libman install @microsoft/signalr -p unpkg -d wwwroot/lib/signalr --files dist/browser/signalr.js --files dist/browser/signalr.min.js
```
The parameters specify the following options:
@ -361,7 +361,7 @@ The SignalR server library is included in the `Microsoft.AspNetCore.App` metapac
```console
wwwroot/lib/signalr/dist/browser/signalr.js written to disk
wwwroot/lib/signalr/dist/browser/signalr.min.js written to disk
Installed library "@aspnet/signalr@1.0.3" to "wwwroot/lib/signalr"
Installed library "@microsoft/signalr@3.0.1" to "wwwroot/lib/signalr"
```
# [Visual Studio for Mac](#tab/visual-studio-mac)
@ -377,7 +377,7 @@ The SignalR server library is included in the `Microsoft.AspNetCore.App` metapac
* Run the following command to get the SignalR client library by using LibMan.
```console
libman install @aspnet/signalr -p unpkg -d wwwroot/lib/signalr --files dist/browser/signalr.js --files dist/browser/signalr.min.js
libman install @microsoft/signalr -p unpkg -d wwwroot/lib/signalr --files dist/browser/signalr.js --files dist/browser/signalr.min.js
```
The parameters specify the following options:
@ -390,7 +390,7 @@ The SignalR server library is included in the `Microsoft.AspNetCore.App` metapac
```console
wwwroot/lib/signalr/dist/browser/signalr.js written to disk
wwwroot/lib/signalr/dist/browser/signalr.min.js written to disk
Installed library "@aspnet/signalr@1.0.3" to "wwwroot/lib/signalr"
Installed library "@microsoft/signalr@3.x.x" to "wwwroot/lib/signalr"
```
---
@ -451,17 +451,17 @@ The SignalR server must be configured to pass SignalR requests to SignalR.
* In the integrated terminal, run the following command:
```dotnetcli
dotnet run -p SignalRChat.csproj
```
```dotnetcli
dotnet run -p SignalRChat.csproj
```
# [Visual Studio for Mac](#tab/visual-studio-mac)
# [Visual Studio for Mac](#tab/visual-studio-mac)
* From the menu, select **Run > Start Without Debugging**.
* From the menu, select **Run > Start Without Debugging**.
---
---
* Copy the URL from the address bar, open another browser instance or tab, and paste the URL in the address bar.
* Copy the URL from the address bar, open another browser instance or tab, and paste the URL in the address bar.
* Choose either browser, enter a name and message, and select the **Send Message** button.