Fixed issue webmvc signalr not notifying submitting state
This commit is contained in:
parent
ad76fa01ad
commit
cdeaa30b2f
@ -96,17 +96,11 @@
|
|||||||
if ('@User.Identity.IsAuthenticated' === 'True') {
|
if ('@User.Identity.IsAuthenticated' === 'True') {
|
||||||
var timerId;
|
var timerId;
|
||||||
|
|
||||||
let connection = stablishConnection();
|
stablishConnection((conn) => registerNotificationHandlers(conn));
|
||||||
|
|
||||||
connection.start().then(function () {
|
|
||||||
console.log('User Registered to Signalr Hub');
|
|
||||||
});
|
|
||||||
|
|
||||||
registerNotificationHandlers(connection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stablishConnection() {
|
function stablishConnection(cb) {
|
||||||
return new signalR.HubConnectionBuilder()
|
let connection = new signalR.HubConnectionBuilder()
|
||||||
.withUrl('@settings.Value.SignalrHubUrl/hub/notificationhub', {
|
.withUrl('@settings.Value.SignalrHubUrl/hub/notificationhub', {
|
||||||
transport: signalR.HttpTransportType.LongPolling,
|
transport: signalR.HttpTransportType.LongPolling,
|
||||||
accessTokenFactory: () => {
|
accessTokenFactory: () => {
|
||||||
@ -114,6 +108,11 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
connection.start().then(function () {
|
||||||
|
console.log('User Registered to Signalr Hub');
|
||||||
|
cb(connection);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerNotificationHandlers(connection) {
|
function registerNotificationHandlers(connection) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user