locked
SignalR client (in Window web browser control) is skipping messages from server RRS feed

  • Question

  • User-1492506496 posted

     Hi,

    We have implemented SignalR-1.1.3 in our MVC web application. Our web application runs in some third party Windows form applications' web browser control.

    The process is as below -

    1. 3 PDF files are generated (pdf files do not contain Policy Number.) and loaded in separate iFrame in some MVC razor view and this view is rendered within windows browser web control of some third party Windows application. While rendering pdf files is rendered, we register these winform windows with SignalR GroupName. 

    2. After some business processing the 3 new pdf files are generated which contains Policy Number  and a notification is sent to SignalR server which is hosted in some asp.net web service.

    3. SignalR server sends new pdf url to SignalR client for all 3 pdf files and old pdf window browser web control is refreshed with corresponding new pdf files which contains a Policy Number.

    In current scenario all 3 pdf files are not getting refreshed. Some times it refreshes two pdf files and some times only one pdf file.

    Below is the SignalR code which we are using at client and server side:

    Jquery SignalR Client - 

        <script type="text/javascript">
           
            $(document).ready(function () {            
                var PDFFileName = $('#hdnPDFFileName').val();
                var connection = $.connection($('#hdnPDFRegnerateNotificationURL').val(), "groupname=" + PDFFileName, true);
                //On received event
                connection.received(function (data) {
                    var recMsg = data.toString().split('~');                
                    //Change PDF name in iframe
                    $('#frmPDFContainer').attr('src', $('#hdnPDFURL').val() + recMsg[1] +".pdf");
                });
                connection.error(function (err) {
                });
                //Start Connection
                connection.start({ jsonp: true });
            });
    
        </script>

    SignalR Server hosted in asp.net web service-

        public class Notification : System.Web.Services.WebService
        {
            private  string ServiceUri = System.Configuration.ConfigurationManager.AppSettings["SignalRServerURL"].ToString(); 
            [WebMethod]
            public void SendNotification(string groupName, string message, string PDFName)
            {
                var connection = new Connection(ServiceUri, "groupname=" + groupName);
    
                //Connecting... to the server
                connection.Start().Wait();
    
                //Send Notification....
                connection.Send(message+DateTime.Now.ToString() + "~" + PDFName).Wait();
    
                //Disconnect fron Server
                connection.Stop();
    
            }
    
    
        }

    While debugging, we found that SignalR service is sending messages for all 3 pdf files but SignalR client which is with in Windows web browser control is not receiving messages for all 3 pdf files.

    It works fine when we render the pdf files in Internet Explorer or some other Browser and not in Windows browser control. Even it works when we put an alert in connection.received() function in our SignalR client. We have also tried to put setTimeout function in connection.received() function but it didn't work.

    Please help. 

    Friday, September 23, 2016 7:31 AM

All replies