locked
signalr/hubs file does not get generated RRS feed

  • Question

  • User817763318 posted

    I did everything according to official documentation. 

    (all the signalr related files are located in myproject/market/alpha)

    this is my Hub class

    public class AlphaHub : Hub
        {
            public void Send(string name, string message)
            {
                Clients.All.broadcastMessage(name, message);
            }
        }

    startup

    namespace Coinmania.market.alpha
    {
        public class SIgnalRStartup
        {
            public void Configuration(IAppBuilder app)
            {
                app.MapSignalR();
            }
        }
    }
    

    script(located in Default.aspx)

        <!--Script references. -->
        <!--Reference the jQuery library. -->
        <script src='<%: ResolveClientUrl("/Scripts/jquery-3.3.1.min.js") %>'></script>
        <script src='<%: ResolveClientUrl("/Scripts/jquery.signalR-2.2.2.min.js") %>'></script>
        <script src="/signalr/hubs"></script>
    
        <!--Add script to update the page and send messages.-->
        <script type="text/javascript">
            $(function () {
                // Declare a proxy to reference the hub.
                var alpha = $.connection.alphaHub;
                // Create a function that the hub can call to broadcast messages.
                alpha.client.broadcastMessage = function (message) {
                    alert(message);
                };
                // Start the connection.
                $.connection.hub.start();
            });
        </script>

    I am really curious. What is the problem? When I created a separate test project, it worked fine. 

    Thursday, February 13, 2020 8:20 AM

All replies

  • User-775646050 posted

    We don't know what the problem is because you haven't stated what you are expecting to happen and what is actually happening. I would probably start by using your browser's dev tools though. You may have some errors that are blocking it from working or the paths to your javascript libraries may be incorrect in this project.

    Thursday, February 13, 2020 4:28 PM
  • User817763318 posted

    signalr/hubs is an auto-generated file. 

    The problem is, it does not get generated. Here is what error says 

    Failed to load resource: the server responded with a status of 404 (Not Found)

    When I see the path to the hubs file, it says localhost:8888/signalr/hubs

    Thursday, February 13, 2020 4:42 PM
  • User283571144 posted

    Hi gugatodua,

    Could you please tell me your folder build-up for your whole application?

    I guess the 404 error is you used the wrong signlar hubs path.

    Best Regards,

    Brando

    Friday, February 14, 2020 9:54 AM