locked
Using Signalr with Ionic2 RRS feed

  • Question

  • User1269155039 posted

    Trying to utilize signalr in Ionic2.

    Steps taken:

    • Installed signalr@2.2.1 and jquery@2.2.3 with npm.

    • Importing them with

     import * as $ from 'node_modules/jquery';
     import 'node_modules/signalr';
    
    • Trying to establish connection with server with $.hubConnection(..)

    • Fails on run, giving following error:

    jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.

    Sunday, February 5, 2017 6:57 PM

All replies

  • User-271186128 posted

    Hi shyamal890,

    Fails on run, giving following error:

    jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.

    From your description, it seems that you didn't add the JQuery reference. Please check your code, and make sure the jQuery is referenced before the SignalR client JavaScript file, and load successful. You could refer to the following code:

        <!--Script references. -->
        <!--Reference the jQuery library. -->
        <script src="Scripts/jquery-1.6.4.min.js" ></script>
        <!--Reference the SignalR library. -->
        <script src="Scripts/jquery.signalR-2.1.0.min.js"></script>
        <!--Reference the autogenerated SignalR hub script. -->
        <script src="signalr/hubs"></script>

    Best regards,
    Dillion

    Monday, February 6, 2017 3:21 AM