Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand correctly, you need a way of associating a task to a given user/client so that you can tell the client when their task has completed.</p> <p>SignalR API documentation tells me you can call JS methods for specific clients based on the client id (<a href="https://github.com/SignalR/SignalR/wiki/SignalR-Client" rel="noreferrer">https://github.com/SignalR/SignalR/wiki/SignalR-Client</a>). In theory you could do something like:</p> <ol> <li>Store the client id used by SignalR as part of the task metadata:</li> <li>Queue the task as normal.</li> <li>When the task is processed and de-queued: <ul> <li>Update your database with the status.</li> <li>Using the client id stored as part of that task, use SignalR to send that client a notification:</li> </ul></li> </ol> <p>You should be able to retrieve the connection that your client is using and send them a message:</p> <pre><code>string clientId = processedMessage.ClientId //Stored when you originally queued it. IConnection connection = Connection.GetConnection&lt;ProcessNotificationsConnection&gt;(); connection.Send(clientId, "Your data was processed"); </code></pre> <p>This assumes you mapped this connection and the client used that connection to start the data processing request in the first place. Your "primary navigation bar" has the JS that started the connection to the <code>ProcessNotificationsConnection</code> endpoint you mapped earlier.</p> <p><strong>EDIT: From <a href="https://github.com/SignalR/SignalR/wiki/Hubs" rel="noreferrer">https://github.com/SignalR/SignalR/wiki/Hubs</a></strong></p> <pre><code>public class MyHub : Hub { public void Send(string data) { // Invoke a method on the calling client Caller.addMessage(data); // Similar to above, the more verbose way Clients[Context.ClientId].addMessage(data); // Invoke addMessage on all clients in group foo Clients["foo"].addMessage(data); } } </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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