locked
Communication from client to WCF for user session management RRS feed

  • Question

  • User-1070963513 posted

    I am trying to set up a kind of heartbeat system where users on my .net site will send a message to my WCF service through signalR, so that the service knows they are still online. When the service does not receive a ping it will remove their session information from the database. However i cannot work out how to get my site to connect to the signalR hub. At the moment i just get a 404 not found error.

    Global.js

            var connection = $.hubConnection();
        connection.url = "http://localhost:63782/session";
        var hubProxy = connection.createHubProxy('SessionHub');
    
    
        connection.start({ jsonp: true }).done(function () {
            connection.server.CheckSession("id")
        });
    

    SessionHub.cs (inmy WCF project)

        using Microsoft.AspNet.SignalR;
    
    namespace VisionMobileService.Classes
    {
        public class SessionHub : Hub
        {
    
            public void CheckSession(string SessionID)
            {
    
            }
        }
      }
    

    Startup.cs (in my wcf project)

        using System;
    using System.Threading.Tasks;
    using Microsoft.Owin;
    using Owin;
    using Microsoft.Owin.Builder;
    using System.Web.Routing;
    using VFF.VisionTouch.DataService.Classes;
    
    [assembly: OwinStartup(typeof(VisionMobileService.Classes.Startup))]
    namespace VisionMobileService.Classes
    {
        public class Startup
        {
            public void Configuration(AppBuilder app)
            {
               // app.MapSignalR("/session", new Microsoft.AspNet.SignalR.HubConfiguration() { EnableJSONP = true });
                app.MapSignalR<SessionConnection>("/session");
            }
        }
    }
    

    can anyone see where i am going wrong? I should also note that I am planning on changing it to a persistent connection once I get the basics working.

    Thanks.

    Tuesday, February 21, 2017 9:26 AM

All replies