run this in nuget package manager
Install-Package Microsoft.AspNet.SignalR
source:
signalR/ChatHub.cs
using Microsoft.AspNet.SignalR; //using Microsoft.AspNetCore.SignalR; using System.Threading.Tasks; using Microsoft.AspNet.SignalR.Hubs; namespace SignalRChat.Hubs { [HubName("ChatHub")] public class ChatHub : Hub { //public async Task SendMessage(string user, string message) //{ // await Clients.All.SendAsync("ReceiveMessage", user, message); //} /// <summary> /// from https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr /// </summary> /// <param name="name"></param> /// <param name="message"></param> public void Send(string name, string message) { // Call the broadcastMessage method to update clients. Clients.All.broadcastMessage(name, message); } } }
SiteCustom/SignalRStartup.cs
using Microsoft.Owin; using Owin; using Beweb; using Models; using Site.SiteCustom; [assembly: OwinStartup(typeof(SignalRChat.Startup))] namespace SignalRChat { public class Startup { public void Configuration(IAppBuilder app) { Logging.dlog("hey"); app.MapSignalR(); } } }
files added:
bin/Microsoft.AspNet.SignalR.Core.dll
bin/Microsoft.AspNet.SignalR.Core.xml
bin/Microsoft.AspNet.SignalR.SystemWeb.dll
bin/Microsoft.AspNet.SignalR.SystemWeb.xml
bin/Microsoft.Owin.dll
bin/Microsoft.Owin.Host.SystemWeb.dll
bin/Microsoft.Owin.Host.SystemWeb.xml
bin/Microsoft.Owin.Security.dll
bin/Microsoft.Owin.Security.xml
bin/Microsoft.Owin.xml
bin/Newtonsoft.Json.dll
bin/Newtonsoft.Json.xml
bin/Owin.dll
js/json2
js/json2/cycle.js
js/json2/json2.js
js/json2/README
packages.config
Scripts
Scripts/jquery-1.6.4-vsdoc.js
Scripts/jquery-1.6.4.js
Scripts/jquery-1.6.4.min.js
Scripts/jquery.signalR-2.4.1.js
Scripts/jquery.signalR-2.4.1.min.js
signalR (folder)
signalR/ChatHub.cs
SiteCustom/SignalRStartup.cs
tests/test-signalr.aspx
bin/Microsoft.AspNet.SignalR.
bin/Microsoft.AspNet.SignalR.
bin/Microsoft.AspNet.SignalR.
bin/Microsoft.Owin.dll
bin/Microsoft.Owin.Host.
bin/Microsoft.Owin.Host.
bin/Microsoft.Owin.Security.
bin/Microsoft.Owin.Security.
bin/Microsoft.Owin.xml
bin/Newtonsoft.Json.dll
bin/Newtonsoft.Json.xml
bin/Owin.dll
js/json2
js/json2/cycle.js
js/json2/json2.js
js/json2/README
packages.config
Scripts
Scripts/jquery-1.6.4-vsdoc.js
Scripts/jquery-1.6.4.js
Scripts/jquery-1.6.4.min.js
Scripts/jquery.signalR-2.4.1.
Scripts/jquery.signalR-2.4.1.
signalR (folder)
signalR/ChatHub.cs
SiteCustom/SignalRStartup.cs
tests/test-signalr.aspx
site.csproj
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Microsoft.AspNet.SignalR.Core.2.4.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.SignalR.SystemWeb, Version=2.4.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Microsoft.AspNet.SignalR.SystemWeb.2.4.1\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll</HintPath>
</Reference>
</Reference>
<Reference Include="Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Compile Include="signalR\ChatHub.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SiteCustom\SignalRStartup.cs" />
<Content Include="packages.config" />
<None Include="Scripts\jquery-1.6.4-vsdoc.js" />
<Content Include="Scripts\jquery-1.6.4.js" />
<Content Include="Scripts\jquery-1.6.4.min.js" />
<Content Include="Scripts\jquery.signalR-2.4.1.js" />
<Content Include="Scripts\jquery.signalR-2.4.1.min.js" />
<Content Include="tests\test-signalr.aspx" />
<SpecificVersion>False</
<HintPath>packages\Microsoft.
</Reference>
<Reference Include="Microsoft.AspNet.
<SpecificVersion>False</
<HintPath>packages\Microsoft.
</Reference>
</Reference>
<Reference Include="Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=
<SpecificVersion>False</
<HintPath>packages\Microsoft.
</Reference>
<Reference Include="Microsoft.Owin.Host.
<SpecificVersion>False</
<HintPath>packages\Microsoft.
</Reference>
<Reference Include="Microsoft.Owin.
<SpecificVersion>False</
<HintPath>packages\Microsoft.
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=
<SpecificVersion>False</
<HintPath>packages\Newtonsoft.
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=
<SpecificVersion>False</
<HintPath>packages\Owin.1.0\
</Reference>
<Reference Include="System.Security" />
<Compile Include="signalR\ChatHub.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SiteCustom\
<Content Include="packages.config" />
<None Include="Scripts\jquery-1.6.4-
<Content Include="Scripts\jquery-1.6.4.
<Content Include="Scripts\jquery-1.6.4.
<Content Include="Scripts\jquery.
<Content Include="Scripts\jquery.
<Content Include="tests\test-signalr.
check localhost/testwebapp/signalr/hubs is working
Leave a Comment
Comments