using connectionhandlers with websockets

This commit is contained in:
JanEggers
2018-07-07 10:42:33 +02:00
parent 6ca6a52ae8
commit bc6f155f12
2 changed files with 17 additions and 6 deletions
+7 -2
View File
@@ -22,13 +22,18 @@ namespace MQTTnet.TestApp.AspNetCore2
.Build();
services
.AddHostedMqttServer(mqttServerOptions)
.AddMqttConnectionHandler();
.AddMqttConnectionHandler()
.AddConnections();
}
// In class _Startup_ of the ASP.NET Core 2.0 project.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMqttEndpoint();
app.UseConnections(c => c.MapConnectionHandler<MqttConnectionHandler>("/mqtt", options => {
options.WebSockets.SubProtocolSelector = MQTTnet.AspNetCore.ApplicationBuilderExtensions.SelectSubProtocol;
}));
//app.UseMqttEndpoint();
app.UseMqttServer(server =>
{
server.Started += async (sender, args) =>