asp.net mvc - C# MVC - Send message with SignalR from server to Caller -


i have request client server using signalr-2.2.1. after request, server send results caller. here javascript code :

$(document).ready(function () {     var myhub = $.connection.signalhub;     myhub.client.receive = function (tmp) {         var obj = $.parsejson(tmp);         //do     };     $.connection.hub.start().done(function () {         $('#xxxxx').click(function () {             var form = $("form");             form.submit();             myhub.server.sendsomething();         });     }).fail(function (reason) {        //do     }); }); 

and here code server side

public partial class signalhub : hub {     public void sendsomething()     {          clients.all.receive(myjson);     } } 

when use clients.all function, works fine. want server send result caller (the 1 send request). change clients.all.receive(myjson) clients.caller.receive(myjson). after change it, client doesnt update content. need specify receive function in client side receive different?

my guess since calling form.submit(); navigating away page or possibly reloading it, in sense new connection different "connectionid" established between new/reloaded page, message intended client.caller lost since associated connection established on page navigated away or refreshed.

you might want consider posting form-data using ajax instead of full form submit.


Comments

Popular posts from this blog

loops - Spock: How to use test data with @Stepwise -

amazon web services - S3 Pre-signed POST validate file type? -