Update: SignalR AddToGroups at Query String
Use OnConnection query string to add group membership rather than making an additional call after connection.
This commit is contained in:
@@ -408,15 +408,13 @@
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
var liveMessagesConnection = $.connection('@(Url.Content("~/API/Repository/Notifications"))')
|
||||
var liveMessagesConnection = $.connection('@(Url.Content("~/API/Repository/Notifications"))', { addToGroups: 'JobLog,JobAttachment' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start(function () {
|
||||
liveMessagesConnection.send('/addToGroups:JobLog,JobAttachment');
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
//#endregion
|
||||
|
||||
});
|
||||
|
||||
@@ -789,15 +789,13 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"')
|
||||
WriteLiteral(@"', { addToGroups: 'JobLog,JobAttachment' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start(function () {
|
||||
liveMessagesConnection.send('/addToGroups:JobLog,JobAttachment');
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
//#endregion
|
||||
|
||||
});
|
||||
|
||||
@@ -246,10 +246,9 @@
|
||||
});
|
||||
}
|
||||
function updateWithLive() {
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/TaskStatusNotifications"))');
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/TaskStatusNotifications"))', {addToGroups: sessionId});
|
||||
liveConnection.received(update_Received);
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:' + sessionId);
|
||||
updateWithAjax();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -296,10 +296,9 @@ WriteLiteral("\';\r\n\r\n // Clear Menu\r\n $(\'#menu\').empty();\
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
WriteLiteral(@"', {addToGroups: sessionId});
|
||||
liveConnection.received(update_Received);
|
||||
liveConnection.start(function () {
|
||||
liveConnection.send('/addToGroups:' + sessionId);
|
||||
updateWithAjax();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user