I am following the walkthrough: Getting Started with SignalR on ASP.NET Core.
The line app.UseBrowserLink() generates the error in the title.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@MCcoder52 For now you can either add the Microsoft.VisualStudio.Web.BrowserLink
Nuget package, or you can remove the line that calls BrowserLink.
I'm going to update the doc within the next few days and add BroserLink package in.
@rachelappel isn't UBL in the M.A.All package?
@Rick-Anderson It was not at the time of publishing and it isn't in the code sample.
<PackageReference Include="Microsoft.AspNetCore.App" />
is not in the current sample?
No. A different version. It needs to be updated. Others have mentioned they get a Browserlink error that goes away when you add in the package. Plus there were some items missing in the update from earlier in the week. I was going to address them here.
Hi @Rick! Thanks for posting this tutorial. It's helpful.
But I prefer the previous version because:
1/. Previous version was using GUID for ConnectionId while this is using something like: "aexAN5Hq8yXc_4km1shgzQ" for ConnectionId. What's that?
2/. This version replaces the method name "InvokeAsync" by "SendAsync" on server side, but still uses "invoke" on client side. Although it's working, I think it's better if we can use the same name: "InvokeAsync" with "invoke" or "SendAsync" with "send".
3/. I don't know why but I cannot use the previous version from yesterday. It threw the exception: "Websocket closed with status code: 1011". When I tried to call "connection.start()", it connected to server successful, then it closed the connection automatically and the "connectionState" became 3. After searching for the solution more than 1 hour ^^!, I got it: update signalr on both server side and client side. It's same to "This version is obsolete."
4/. Here's not a bug or an issue, it's my suggestion: sometimes, we want to call the "on" method on client side multiple times. So, we may want to define them as:
connection
.on("action_1", function (){})
.on("action_2", function (){})
.on("action_3", function (){});
instead of:
connection.on("action_1", function(){});
connection.on("action_2", function(){});
connection.on("action_3", function(){});
In the previous version, I'd tried to custom the connection as a plugin:
let HubConnection = (function () {
class HubConnection extends signalR.HubConnection {
constructor(hubName) {
super(hubName);
}
on(key, callback) {
super.on(key, callback);
return this;
}
}
return HubConnection;
}());
Then:
let connection = new HubConnection('/hubs/chat');
let hubEvent = {
send: data => console.log(data),
foo: function (){}
};
connection
.on('send', hubEvent.send)
.on('foo', hubEvent.foo);
connection.start().then(() => console.log('Hub connected!'));
Hope SignalR team can accept this suggestion.
5/. Here's a suggestion, too. But I like it so much. I've written a plugin what supports for video call using SignalR. It's good: https://preview.ibb.co/buMBfd/Untitled.png
But I hope SignalR team can support this features for future (both live stream and video call). Something like: I believe the code that is written by SignalR team is better than me :))
Thank you!
@rachelappel can we remove UseBrowserLink from the code sample? It's gone in all of the templates.
@davidfowl I took out Browserlink because it caused errors, because there was the call in Startup but no reference and multiple customers complained that their code doesn't work. It appears to have been added back in (someone else's PR, I didn't get any chance to add that in). I can take it out again now that it's out of the templates.
Great. We should have our samples align with what’s in the final 2.1 templates.
Also feedback from the other issues suggest that our walkthroughs should have runnable samples backing them. That’ll make it obvious what’s in the project file.
Fixed here https://github.com/aspnet/Docs/pull/6532
@rachelappel This still appears when creating a new .NET core application with MVC and trying to add AD sign in. Code template that appeared is below. I'm assuming I can just remove the line as you've mentioned above, but wanted to make you aware that it's still popping up in some areas.
```using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Timeline
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddAzureAd(options => Configuration.Bind("AzureAd", options))
.AddCookie();
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseAuthentication();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
```
Most helpful comment
@MCcoder52 For now you can either add the
Microsoft.VisualStudio.Web.BrowserLink
Nuget package, or you can remove the line that calls BrowserLink.I'm going to update the doc within the next few days and add BroserLink package in.