locked
SignalR with Ionic Mobile Application RRS feed

  • Question

  • User86477287 posted

    Unable to connect signalR from ionic mobile app.

    i'm facing the issue when i go to connect signalR from my application.I mentioned my code below please help me.

    demo.ts

    startSignalR(){
        $(function () {
          debugger
          let script = document.createElement('script');
          $.connection.hub.url = "http://localhost:53405/signalr/hubs";
          $.connection.hub.start().done(function () 
          { 
            console.log("hub done"); 
            script.src = "../../assets/ExtraJs/test.js";
          }).fail(function(e)
          {
            console.log(e);
          });
        });
      }
    
    

    When I debug this function i get an error like
    
    jQuery.Deferred exception: Cannot read property 'hub' of undefined TypeError: Cannot read property 'hub' of undefined

    $.connection.hub.url = "http://localhost:53405/signalr/hubs";

    getting error with above statement. hub is undefined.Please suggest the solution.

    Thanks.

    Thursday, January 17, 2019 12:38 PM

All replies

  • User61956409 posted

    Hi Divyesh Padamani,

    Welcome to ASP.NET forums.

    Divyesh Padamani

    Query.Deferred exception: Cannot read property 'hub' of undefined TypeError: Cannot read property 'hub' of undefined

    Please make sure if you import and add required references, such as jQuery, the SignalR JavaScript file and dynamically generated proxy JavaScript file.

    With Regards,

    Fei Han

    Friday, January 18, 2019 1:27 AM
  • User86477287 posted

    hi Fei Han,

    I already imported all that required file. But i cant connect with signalR server from my application. i can provide you more information if you want.

    Thanks,

    Divyesh Padamani

    Friday, January 18, 2019 4:47 AM
  • User61956409 posted

    Hi Divyesh Padamani,

    You can share us the detailed steps of you build the SignalR client application in TypeScript, so that we can reproduce and troubleshoot issue better.

    With Regards,

    Fei Han

    Wednesday, January 23, 2019 3:07 AM