Diagram clicked event: Error in Chrome and losing connection to server

I am using the diagram clicked event as below. When I click on the diagram background, the connection to the server is lost and an error appears in the Chrome console (see below). However, if I click on a node on the diagram, this behavior does not occur. This occurs when there is no code in the event handler so it is not my code inside the handler.

I want to reset my selected node variable (type custom class) to null when the user clicks on the background of the diagram.

        public void DiagramClicked(IBlazorClickEventArgs args)
        {
            //if (args.ActualObject.Diagram != null)
            //{
            //    SelectedNode = null;
            //}
        }

                    <SfDiagram @ref="@Diagram" Height="750px" Width="@DiagramWidth" Nodes="@NodeCollection" Connectors="@ConnectorCollection" Tool="@tool">
                        <DiagramEvents DragEnter="@OnDrop" SelectionChanged="@OnSelectionChanged" Clicked="@DiagramClicked"></DiagramEvents>
                        <DiagramPageSettings>
                            <DiagramFitOptions CanFit="true" Mode="@FitModes.Page"></DiagramFitOptions>
                        </DiagramPageSettings>
                    </SfDiagram>

blazor.server.js:1 [2020-09-07T17:02:55.281Z] Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'.
e.log @ blazor.server.js:1
e.stopConnection @ blazor.server.js:1
transport.onclose @ blazor.server.js:1
e.close @ blazor.server.js:1
e.stop @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
a @ blazor.server.js:1
Promise.then (async)
c @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
M @ blazor.server.js:1
e.stopInternal @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
M @ blazor.server.js:1
e.stop @ blazor.server.js:1
e.processIncomingData @ blazor.server.js:1
connection.onreceive @ blazor.server.js:1
i.onmessage @ blazor.server.js:1
blazor.server.js:1 [2020-09-07T17:02:58.283Z] Information: Normalizing '_blazor' to 'https://localhost:44324/_blazor'.
blazor.server.js:1 [2020-09-07T17:02:58.297Z] Information: WebSocket connected to wss://localhost:44324/_blazor?id=DhAWaYnQWIpONgM7YCEBQQ.

3 Replies 1 reply marked as answer

AR Aravind Ravi Syncfusion Team September 8, 2020 04:54 AM UTC

Hi Scott,  
  
By default , in the blazor,  If the data loaded from client to server is more than 32KB means then server reconnect issue occurs in the blazor. Please find the below github link for more information about issue 
  
  
To overcome this increase the message size in the startup.cs file. In the startup.cs file in the ConfigureServices method add the below service to increase the message size  
  
public void ConfigureServices(IServiceCollection services)  
        {  
            services.AddRazorPages();  
            services.AddServerSideBlazor();  
            services.AddSyncfusionBlazor();  
            services.AddSingleton<HMIService>();  
            services.AddSingleton<MQService>();  
            services.AddServerSideBlazor().AddHubOptions(o =>  
            {  
                o.MaximumReceiveMessageSize = 102400000;  
            });  
        }  
  
After increase the receive message size in the startup.cs file, the sample has been run properly at our end without any server reconnect issues and events has been triggered properly. Please find the video in below link  
  
  
We have modified a sample by adding a service in startup file. We have attached a sample in below link  
  
 
Regards  
Aravind Ravi  
 


Marked as answer

SP Scott Peal September 8, 2020 01:52 PM UTC

Thanks. I have confirmed that this fixed the issue. Note that there is no data being added to the page or controls outside of a very basic Splitter with Diagram inside. Thanks again.


AR Aravind Ravi Syncfusion Team September 9, 2020 07:38 AM UTC

Hi Scott, 

Thanks for the update. 

Regards 
Aravind Ravi 


Loader.
Up arrow icon