public class ChatHub : Hub
{
public void Send(string name, string message)
{
// Call the broadcastMessage method to update clients.
Clients.All.broadcastMessage(name, message);
}
}
-Startup file
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Any connection or hub wire up and configuration should go here
app.MapSignalR();
}
}
When i run page :
$(function () {
// Reference the auto-generated proxy for the hub.
var chat = $.connection.chatHub;
});
error:
[assembly: OwinStartup(typeof(SignalRProgress.Startup))]
namespace SignalRProgress
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Any connection or hub wire up and configuration should go here
app.MapSignalR();
}
}
}
I had the same problem with 7.3.0, got it solved now. As far as I could tell it has to do with the fact that Umbraco uses OWIN since 7.3.0.
See web.config, it has an entry
Before 7.2.8 it didn't use this. You probably have your Startup.cs class to register the use of SignalR? The startup class doesn't get called in the new 7.3.0 scenario. To fix this, create a class that inherits from UmbracoDefaultOwinStartup and add the SignalR usage. Change the web.config entry to the friendly name you give your OWIN class.
<add key="owin:appStartup" value="TestStartup" />
With my Startup.cs looking like this:
using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;
using Umbraco.Web;
[assembly: OwinStartup("TestStartup", typeof(WebApplication1.Startup))]
namespace WebApplication1
{
public class Startup : UmbracoDefaultOwinStartup
{
public override void Configuration(IAppBuilder app)
{
base.Configuration(app);
app.MapSignalR();
}
}
}
SignalR Chat
Hi All.
I'm using umbraco v7.0. I would build project chat with SignalR microsoft. The structure of project: App(web umbraco) -View include js files -
MVC(build controller) - ChatHub file-Startup file public class Startup { public void Configuration(IAppBuilder app) { // Any connection or hub wire up and configuration should go here app.MapSignalR(); }
}
When i run page : $(function () { // Reference the auto-generated proxy for the hub.
var chat = $.connection.chatHub; }); error:
404 not found.
Please help me fix this issue.
Thanks
Hi,
Do you have a Configuration method?
Hi Alex Skrypnyk
I have init code
app.MapSignalR();
but it is not working.
error :
404 not found
Hi Duyquy301,
many this blog post helps http://joeriks.com/2011/11/21/using-signalr-with-umbraco-to-broadcast-messages-or-chat-15-minutes/
Hi Marcel van Helmont
Thanks
Did you add '~/signalr/hubs' path to the umbraco reserved paths ?
Thanks, Alex
Hi Alex Skrypnyk
Yep, i have added umbracoReservedPaths
Thanks
Hi,
What error do you have now ?
Thanks
Hi Alex Skrypnyk
Now i have errror
http://localhost:282/signalr/hubs/ 400 (Bad request)
Thanks
this is error http://localhost:282/signalr/hubs/ 404 (Not Found)
Thanks
Hi Alex Skrypnyk
It is working.
Thanks
Hi,
What was the problem ?
Comment author was deleted
Would also love to know what the problem was and how it was resolved since I get the same behaviour on a 7.3.0 site (working fine on 7.2.8)
I had the same problem with 7.3.0, got it solved now. As far as I could tell it has to do with the fact that Umbraco uses OWIN since 7.3.0. See web.config, it has an entry
Before 7.2.8 it didn't use this. You probably have your Startup.cs class to register the use of SignalR? The startup class doesn't get called in the new 7.3.0 scenario. To fix this, create a class that inherits from UmbracoDefaultOwinStartup and add the SignalR usage. Change the web.config entry to the friendly name you give your OWIN class.
With my Startup.cs looking like this:
HTH
is working on a reply...