Note that there are some explanatory texts on larger screens.

plurals
  1. POClients is null when trying to send message via signalR
    primarykey
    data
    text
    <p>I have the following hub in my MVC application from where I would like to send a simple message to my client side code:</p> <pre><code>using SignalR.Hubs; public class Progress : Hub { public void Send(string message) { // Call the addMessage method on all clients Clients.addMessage(message); } public Progress() { Clients.addMessage("Starting to analyze image"); } } </code></pre> <p>And the following javascript in my view</p> <pre><code> &lt;script src="/Scripts/jquery.signalR.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/signalr/hubs" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { // Proxy created on the fly var connection = $.connection('/signalr/hubs/progress'); // Declare a function on the chat hub so the server can invoke it connection.addMessage = function (message) { $('#messages').append('&lt;li&gt;' + message.Content + '&lt;/li&gt;'); }; // Start the connection connection.start(); }); &lt;/script&gt; } </code></pre> <p>My problem is when the code calls the constructor, or the Send method for that matter, the Clients object is null.</p> <p>Everything looks OK when I debug the client side code. The /signalr/hubs/ route returns javascript code and there are no errors when the javascript is run.</p> <p>I can add that the backend code runs on top of the Umbraco 5 CMS environment which I am not sure is causing any disturbances.</p> <p>Any suggestions on how I can debug/solve this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload