I experimented signalr using an example on

[http://www.c-sharpcorner.com/UploadFile/78d182/signalr-sample-chat-application-in-C-Sharp/]

It worked fine on localhost within visual studio environment. I separated the server side code and uploaded on a remote server. Now when i try to connect with that remote server it is throwing these exceptions Failed to load resource: the server responded with a status of 404 (Not Found)
Uncaught Type Error: Cannot read property 'client' of undefined connect.js :9 my code is as in a connect.js file as following block of code

 $(function () {
    alert('i m here');
    $.connection.hub.url = "http://info2gsm.com";
    var IWanaChat = $.connection.myChatHub;
    IWanaChat.client.addMessage = function (message) {
    $("#listMessages").append('<li>' + message + '</li>');

    };

    $("#sendMessage").click(function(){
    alert($('#txtMessage').val());
    IWanaChat.server.send($('#txtMessage').val());
    });

    $.connection.hub.start();

    });

my HTML page is as following block

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-         scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />




    <script src="Scripts/jquery-1.8.2.min.js"></script>
    <script src="Scripts/jquery.signalR-1.0.0.js"></script>

    <script src="signalr/hubs" type="text/javascript"></script>
    <script src="Scripts/connect.js"></script>

        <title>Hello World!</title>
    </head>
    <body>

     <div id="listMessages">

        <input type="text" ID="txtMessage"></>
        <br />
        <input  id="sendMessage" type="button" value="Send" /><br />
    </div>
        <script type="text/javascript">
    </script>
        <script type="text/javascript" src="cordova.js"></script>
    </body>
</html>

Thank You.

Related posts

Recent Viewed