$(function () { var connection = new signalR.HubConnectionBuilder() .withUrl('/announcement') .build(); connection.on('send', data => { showannouncement(data); }); function start() { connection.start().catch(function (err) { setTimeout(function () { start(); }, 100000); }); } connection.onclose(function () { start(); }); start(); }); function showannouncement(announcemant) { if (announcemant) { toastr.options = { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": false, "positionClass": "toast-bottom-right", "preventDuplicates": false, "onclick": null, "showDuration": 300, "hideDuration": 10000, "timeOut": 100000, "extendedTimeOut": 20000, "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" }; tostView = '