Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 869866a

Browse files
committed
Updated most samples to RC1
- Use 2.1 template - Make wwwroot folders consistent - Fixed broken samples
1 parent f28a9a0 commit 869866a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8103
-5645
lines changed

ChatSample/ChatSample/ChatSample.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0-preview2-final" />
9-
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-preview2-final" />
8+
<PackageReference Include="Microsoft.AspNetCore.App" />
109
</ItemGroup>
1110

1211
<ItemGroup>

ChatSample/ChatSample/ChatHub.cs renamed to ChatSample/ChatSample/Hubs/ChatHub.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Microsoft.AspNetCore.SignalR;
22

3-
namespace SignalRChatSample
3+
namespace ChatSample.Hubs
44
{
55
public class ChatHub : Hub
66
{

ChatSample/ChatSample/Program.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore;
1+
using Microsoft.AspNetCore;
72
using Microsoft.AspNetCore.Hosting;
8-
using Microsoft.Extensions.Configuration;
9-
using Microsoft.Extensions.Logging;
103

11-
namespace SignalRChatSample
4+
namespace ChatSample
125
{
136
public class Program
147
{
158
public static void Main(string[] args)
169
{
17-
BuildWebHost(args).Run();
10+
CreateWebHostBuilder(args).Build().Run();
1811
}
1912

20-
public static IWebHost BuildWebHost(string[] args) =>
13+
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
2114
WebHost.CreateDefaultBuilder(args)
22-
.UseStartup<Startup>()
23-
.Build();
15+
.UseStartup<Startup>();
2416
}
2517
}

ChatSample/ChatSample/Startup.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
1+
using ChatSample.Hubs;
52
using Microsoft.AspNetCore.Builder;
63
using Microsoft.AspNetCore.Hosting;
7-
using Microsoft.AspNetCore.Http;
84
using Microsoft.Extensions.DependencyInjection;
95

10-
namespace SignalRChatSample
6+
namespace ChatSample
117
{
128
public class Startup
139
{

ChatSample/ChatSample/wwwroot/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
<div class="container">
1616
<input type="text" id="message" />
1717
<input type="button" id="sendmessage" value="Send" />
18-
<!--<input type="hidden" id="displayname" />-->
1918
<ul id="discussion"></ul>
2019
</div>
2120
<!--Script references. -->
2221
<!--Reference the SignalR library. -->
23-
<script type="text/javascript" src="scripts/signalr.js"></script>
22+
<script type="text/javascript" src="lib/signalr.min.js"></script>
2423
<!--Add script to update the page and send messages.-->
2524
<script type="text/javascript">
2625
document.addEventListener('DOMContentLoaded', function () {
@@ -33,7 +32,9 @@
3332
messageInput.focus();
3433

3534
// Start the connection.
36-
var connection = new signalR.HubConnection(url);
35+
var connection = new signalR.HubConnectionBuilder()
36+
.withUrl('/chat')
37+
.build();
3738

3839
// Create a function that the hub can call to broadcast messages.
3940
connection.on('broadcastMessage', function (name, message) {
@@ -48,7 +49,7 @@
4849

4950
// Transport fallback functionality is now built into start.
5051
connection.start()
51-
.then(function (connection) {
52+
.then(function () {
5253
console.log('connection started');
5354
document.getElementById('sendmessage').addEventListener('click', function (event) {
5455
// Call the Send method on the hub.

0 commit comments

Comments
 (0)