Crazy Behavior in SignalR on Azure Web App, works only for tabs in the same browser instance





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















About 3 days we are searching for a solution... local, in IIS Express, everything works fine... after the deploy on Azure Web App, we start facing SignalR going crazy...



We have a WebJob that connects to a hub to send updates in real time...
To validate connection problems, I get a return value from the function called in server, it is all getting there... so, the connections are being made successfuly...



On my hub, after receive the value from the WebJob, i call a Javascript Function on my web app... every user logged in need to receive updates.



But this function never trigger on Azure... Locally it is all working great.



After that, we tried almost everything...



If the request came from the same browser instance, the function were call successfuly.



Check it out here:



Open this link:



http://unique-dev.azurewebsites.net/



Then open this other link to send notification:



http://unique-dev.azurewebsites.net/AdministratorDashboard/SendNotifications?text=mymessage



SignalRClient.js



var uniqueHub;
$(function () {

uniqueHub = $.connection.billingHubNotification;
uniqueHub.client.uniqueEngineAlert = function (content) {
alert(content);
};

$.connection.hub.start()
.done(function () { })
.fail(function () { console.log('Could not Connect!'); });;

$.connection.hub.error(function (error) {
console.log('SignalrAdapter: ' + error);
});
});


Action in Controller



[HttpGet]
[AllowAnonymous]
public ActionResult SendNotifications(string text)
{
try
{
var hubContext = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
var exec = hubContext.Clients.All.uniqueEngineAlert(text);

return Content("Sucesso");
}
catch (Exception ex)
{
return Content("Erro: " + ex.Message);

}
}


Hub



    [HubName("billingHubNotification")]
public class BillingHubNotification : Hub
{
IHubContext _context
{
get
{
var context = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
return context;
}
}
public override Task OnConnected()
{
string name = Context.User.Identity.Name;

_context.Groups.Add(Context.ConnectionId, name);

return base.OnConnected();
}


public void UniqueEngineAlert(string alert, string userNames)
{
foreach (var user in userNames)
{
_context.Clients.Group(user).uniqueEngineAlert(alert);
}
}
}


Could you please SAVE US?










share|improve this question

























  • Based on my experience, the signalr shouldnot be related to the browser instance. If possible, please add the related information about how to call the UniqueEngineAlert method. According to your code, it seems that you try to send the alert based on groups. I recommend that you could try use the following code _context.Clients.All.uniqueEngineAlert(alert); to check whether it can be triggered correctly. If yes, please check the logic of your code.

    – Tom Sun
    Nov 19 '18 at 2:54


















0















About 3 days we are searching for a solution... local, in IIS Express, everything works fine... after the deploy on Azure Web App, we start facing SignalR going crazy...



We have a WebJob that connects to a hub to send updates in real time...
To validate connection problems, I get a return value from the function called in server, it is all getting there... so, the connections are being made successfuly...



On my hub, after receive the value from the WebJob, i call a Javascript Function on my web app... every user logged in need to receive updates.



But this function never trigger on Azure... Locally it is all working great.



After that, we tried almost everything...



If the request came from the same browser instance, the function were call successfuly.



Check it out here:



Open this link:



http://unique-dev.azurewebsites.net/



Then open this other link to send notification:



http://unique-dev.azurewebsites.net/AdministratorDashboard/SendNotifications?text=mymessage



SignalRClient.js



var uniqueHub;
$(function () {

uniqueHub = $.connection.billingHubNotification;
uniqueHub.client.uniqueEngineAlert = function (content) {
alert(content);
};

$.connection.hub.start()
.done(function () { })
.fail(function () { console.log('Could not Connect!'); });;

$.connection.hub.error(function (error) {
console.log('SignalrAdapter: ' + error);
});
});


Action in Controller



[HttpGet]
[AllowAnonymous]
public ActionResult SendNotifications(string text)
{
try
{
var hubContext = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
var exec = hubContext.Clients.All.uniqueEngineAlert(text);

return Content("Sucesso");
}
catch (Exception ex)
{
return Content("Erro: " + ex.Message);

}
}


Hub



    [HubName("billingHubNotification")]
public class BillingHubNotification : Hub
{
IHubContext _context
{
get
{
var context = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
return context;
}
}
public override Task OnConnected()
{
string name = Context.User.Identity.Name;

_context.Groups.Add(Context.ConnectionId, name);

return base.OnConnected();
}


public void UniqueEngineAlert(string alert, string userNames)
{
foreach (var user in userNames)
{
_context.Clients.Group(user).uniqueEngineAlert(alert);
}
}
}


Could you please SAVE US?










share|improve this question

























  • Based on my experience, the signalr shouldnot be related to the browser instance. If possible, please add the related information about how to call the UniqueEngineAlert method. According to your code, it seems that you try to send the alert based on groups. I recommend that you could try use the following code _context.Clients.All.uniqueEngineAlert(alert); to check whether it can be triggered correctly. If yes, please check the logic of your code.

    – Tom Sun
    Nov 19 '18 at 2:54














0












0








0








About 3 days we are searching for a solution... local, in IIS Express, everything works fine... after the deploy on Azure Web App, we start facing SignalR going crazy...



We have a WebJob that connects to a hub to send updates in real time...
To validate connection problems, I get a return value from the function called in server, it is all getting there... so, the connections are being made successfuly...



On my hub, after receive the value from the WebJob, i call a Javascript Function on my web app... every user logged in need to receive updates.



But this function never trigger on Azure... Locally it is all working great.



After that, we tried almost everything...



If the request came from the same browser instance, the function were call successfuly.



Check it out here:



Open this link:



http://unique-dev.azurewebsites.net/



Then open this other link to send notification:



http://unique-dev.azurewebsites.net/AdministratorDashboard/SendNotifications?text=mymessage



SignalRClient.js



var uniqueHub;
$(function () {

uniqueHub = $.connection.billingHubNotification;
uniqueHub.client.uniqueEngineAlert = function (content) {
alert(content);
};

$.connection.hub.start()
.done(function () { })
.fail(function () { console.log('Could not Connect!'); });;

$.connection.hub.error(function (error) {
console.log('SignalrAdapter: ' + error);
});
});


Action in Controller



[HttpGet]
[AllowAnonymous]
public ActionResult SendNotifications(string text)
{
try
{
var hubContext = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
var exec = hubContext.Clients.All.uniqueEngineAlert(text);

return Content("Sucesso");
}
catch (Exception ex)
{
return Content("Erro: " + ex.Message);

}
}


Hub



    [HubName("billingHubNotification")]
public class BillingHubNotification : Hub
{
IHubContext _context
{
get
{
var context = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
return context;
}
}
public override Task OnConnected()
{
string name = Context.User.Identity.Name;

_context.Groups.Add(Context.ConnectionId, name);

return base.OnConnected();
}


public void UniqueEngineAlert(string alert, string userNames)
{
foreach (var user in userNames)
{
_context.Clients.Group(user).uniqueEngineAlert(alert);
}
}
}


Could you please SAVE US?










share|improve this question
















About 3 days we are searching for a solution... local, in IIS Express, everything works fine... after the deploy on Azure Web App, we start facing SignalR going crazy...



We have a WebJob that connects to a hub to send updates in real time...
To validate connection problems, I get a return value from the function called in server, it is all getting there... so, the connections are being made successfuly...



On my hub, after receive the value from the WebJob, i call a Javascript Function on my web app... every user logged in need to receive updates.



But this function never trigger on Azure... Locally it is all working great.



After that, we tried almost everything...



If the request came from the same browser instance, the function were call successfuly.



Check it out here:



Open this link:



http://unique-dev.azurewebsites.net/



Then open this other link to send notification:



http://unique-dev.azurewebsites.net/AdministratorDashboard/SendNotifications?text=mymessage



SignalRClient.js



var uniqueHub;
$(function () {

uniqueHub = $.connection.billingHubNotification;
uniqueHub.client.uniqueEngineAlert = function (content) {
alert(content);
};

$.connection.hub.start()
.done(function () { })
.fail(function () { console.log('Could not Connect!'); });;

$.connection.hub.error(function (error) {
console.log('SignalrAdapter: ' + error);
});
});


Action in Controller



[HttpGet]
[AllowAnonymous]
public ActionResult SendNotifications(string text)
{
try
{
var hubContext = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
var exec = hubContext.Clients.All.uniqueEngineAlert(text);

return Content("Sucesso");
}
catch (Exception ex)
{
return Content("Erro: " + ex.Message);

}
}


Hub



    [HubName("billingHubNotification")]
public class BillingHubNotification : Hub
{
IHubContext _context
{
get
{
var context = GlobalHost.ConnectionManager.GetHubContext<BillingHubNotification>();
return context;
}
}
public override Task OnConnected()
{
string name = Context.User.Identity.Name;

_context.Groups.Add(Context.ConnectionId, name);

return base.OnConnected();
}


public void UniqueEngineAlert(string alert, string userNames)
{
foreach (var user in userNames)
{
_context.Clients.Group(user).uniqueEngineAlert(alert);
}
}
}


Could you please SAVE US?







signalr azure-web-sites






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 '18 at 5:11







Gabriel Guilhem

















asked Nov 17 '18 at 4:55









Gabriel GuilhemGabriel Guilhem

212




212













  • Based on my experience, the signalr shouldnot be related to the browser instance. If possible, please add the related information about how to call the UniqueEngineAlert method. According to your code, it seems that you try to send the alert based on groups. I recommend that you could try use the following code _context.Clients.All.uniqueEngineAlert(alert); to check whether it can be triggered correctly. If yes, please check the logic of your code.

    – Tom Sun
    Nov 19 '18 at 2:54



















  • Based on my experience, the signalr shouldnot be related to the browser instance. If possible, please add the related information about how to call the UniqueEngineAlert method. According to your code, it seems that you try to send the alert based on groups. I recommend that you could try use the following code _context.Clients.All.uniqueEngineAlert(alert); to check whether it can be triggered correctly. If yes, please check the logic of your code.

    – Tom Sun
    Nov 19 '18 at 2:54

















Based on my experience, the signalr shouldnot be related to the browser instance. If possible, please add the related information about how to call the UniqueEngineAlert method. According to your code, it seems that you try to send the alert based on groups. I recommend that you could try use the following code _context.Clients.All.uniqueEngineAlert(alert); to check whether it can be triggered correctly. If yes, please check the logic of your code.

– Tom Sun
Nov 19 '18 at 2:54





Based on my experience, the signalr shouldnot be related to the browser instance. If possible, please add the related information about how to call the UniqueEngineAlert method. According to your code, it seems that you try to send the alert based on groups. I recommend that you could try use the following code _context.Clients.All.uniqueEngineAlert(alert); to check whether it can be triggered correctly. If yes, please check the logic of your code.

– Tom Sun
Nov 19 '18 at 2:54












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348359%2fcrazy-behavior-in-signalr-on-azure-web-app-works-only-for-tabs-in-the-same-brow%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348359%2fcrazy-behavior-in-signalr-on-azure-web-app-works-only-for-tabs-in-the-same-brow%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python