Skip to content

Commit

Permalink
Upgraded to SignalR 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoSuter committed Jun 21, 2018
1 parent aad07f0 commit 06feb8e
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/src/.vs
/src/**/obj
/src/**/bin
/src/New folder
8 changes: 4 additions & 4 deletions src/HelloSignalR/HelloSignalR.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-alpha1-final" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/HelloSignalR/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddSignalR();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseStaticFiles();
app.UseSignalR(routes =>
{
routes.MapHub<ChatHub>("chat");

routes.MapHub<ChatHub>("/chat");
});
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/HelloSignalR/wwwroot/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@

<body>
<label>Message</label>

<input type="text" id="txtMessage">
<input type="button" id="cmdSend" value="Send" onclick="SendMessage()">

<div id="DisplayMessages"></div>
<script src="/Scripts/signalr-client-1.0.0-alpha1-final.min.js"></script>

<script src="/Scripts/signalr.min.js"></script>
<script>
let connection = new signalR.HubConnection('/chat');
var connection = new signalR.HubConnectionBuilder()
.withUrl("/chat")
.configureLogging(signalR.LogLevel.Information)
.build();

connection.on('send', data => {
var DisplayMessagesDiv = document.getElementById("DisplayMessages");
Expand All @@ -23,6 +29,7 @@
});

connection.start().then(() => connection.invoke('send', ''));

function SendMessage() {
var msg = document.getElementById("txtMessage").value;
connection.invoke('send', msg);
Expand Down

This file was deleted.

Loading

0 comments on commit 06feb8e

Please sign in to comment.