Cannot send data if the connection is not in the 'Connected' State

Hi All,

I am using licensed UD 2.5.3 on IIS with windows authentication enabled, running on port 80.
I have a grid which displays data, from SQL DB, I added a button to the grid which performs some calculations and using Show-UDModal display it. However, as soon as I click on the button the following message appears: Cannot send data if the connection is not in the ‘Connected’ State.

If I am running the same on localhost, it work as expected.

Please help to understand where is the problem and how to fix it.

Thank you.

BTW, same happening, when I am trying to present values not from a query, using Adam’s example: https://poshtools.com/2019/01/17/universal-dashboard-adding-buttons-to-a-udgrid/

Another strange thing, when some time passed ~ 5 min(appears like reaching websocket timeout), the buttons start to work.

Here is a screenshot from developer tools of errors that appears:
image

Hi @shykhovtsov are you able to post some code behind this? I too am using 2.5.3 and SQL DB and have no issues on displaying a model for example via a button I build into the grid. Sounds like you are loosing connection to your DB. Bit hard to troubleshoot without seeing your code…So if possible please upload, I do have some examples of how I am doing this on gihub under the same alias I use here psdevuk

Do you have web sockets enabled in IIS?

Hi @psDevUK
As i mentioned above, it is not related to SQL, here is example of code without SQL query which is not working when I am accessing the dashboard from remote.
Here is the page code:

New-UDPage -Name 'Test' -Content {
New-UDGrid -Title "Processes" -Headers @("Process Name", "Id", "View Modules") -Properties @("Name", "Id", "ViewModules") -Endpoint {
    Get-Process | ForEach-Object {
        [PSCustomObject]@{
            Name        = $_.Name
            Id          = $_.Id
            ViewModules = New-UDButton -Text "View Modules" -OnClick (New-UDEndpoint -Endpoint { 
                    Show-UDModal -Content {
                        New-UDTable -Title "Modules" -Headers @("Name", "Path") -Content {
                            $ArgumentList[0] | Out-UDTableData -Property @("ModuleName", "FileName")
                        }
                    } 
                } -ArgumentList $_.Modules)
        }
    } | Out-UDGridData
}

}

Please share your thoughts, why it can happen.
Thank you!

Web-socket feature is installed.
Here is the module status:

And here is the configuration

Please let me know if I am missing something.

On my iPhone atm as my kids want me to take them out…anyways so just asking before I’m assuming but I run everything through my windows 10 pc through iis. Is this the same for you? Sounds similar. Can you ping iis machine from remote machine ok? Is it just this dashboard or any dashboard you having issues with? I had to run some firewall commands through good old cmd for my dashboard to work. Peace

I am using windows 10, target IIS server is windows 2016.
All the ports are open between client and server.

Found something interesting, tried to execute it using edge and it is working - but, in console there are other errors.
Before tested it on Chrome, Version 76.0.3809.132 (Official Build) (64-bit)

Hi All,

I found the issue - it was combination of chrome and “Set Character Encoding” extension, as soon as I disabled this extension everything started to work.

Very sorry for all the noise and thank you for prompt support!

2 Likes

I’m getting this same error but when running ‘Invoke-UDRedirect’ on 2.6.0.

New-UDSideNavItem -Text "FC Performance" -icon table -OnClick { Invoke-UDRedirect -Url https://goggle.com -OpenInNewWindow }

First few clicks work, but then receive the error on subsequent attempts.

Something is killing the websocket connection. Can you open F12 developer tools in your browser to see if there are any errors?

I opened an issue to look into making the websocket connection more resilient: https://github.com/ironmansoftware/universal-dashboard/issues/1174

Seeing the following error in the console log.

Error: Connection disconnected with error ‘Error: Server timeout elapsed without receiving a message from the server.’.

I’m also getting the same issue. When browsing to my dashboard, or hitting f5 on any page in chrome I get a grey screen, nothing loads for a good few minutes.
In the console, I’m noticing websocket connection attempts are timing out, on the retry, this works and the page loads.
This does not occur in IE.

Errors from chrome console:

shboardhub' to 'https://_____/dashboardhub'.

WebSocketTransport.js:35 WebSocket connection to 'wss://_____/dashboardhub?id=NnidBS6MPMSiowDf1erM4Q' failed: WebSocket opening handshake timed out

||(anonymous)|@|WebSocketTransport.js:35|
| --- | --- | --- | --- |
||(anonymous)|@|WebSocketTransport.js:33|
||step|@|tslib.es6.js:97|
||(anonymous)|@|tslib.es6.js:78|
||fulfilled|@|tslib.es6.js:68|

Utils.js:148 Error: Failed to start the transport 'WebSockets': undefined

||push.ConsoleLogger.log|@|Utils.js:148|
| --- | --- | --- | --- |
||(anonymous)|@|HttpConnection.js:248|
||step|@|tslib.es6.js:97|
||(anonymous)|@|tslib.es6.js:78|
||rejected|@|tslib.es6.js:69|

Utils.js:154 Information: SSE connected to https://____/dashboardhub?id=ebtck1Yl6svFA99R_9MM6w

Utils.js:154 Information: Using HubProtocol 'json'.

Is there anything we can do to aid this issue? It’s a bit of a blocker for us at the moment as our organisation heavily relies on chrome.

Does it ever connect? How are you hosting UD?

Eventually it does, after a couple of mins for the timeout, the websocket retries, connects and my page loads. I’m hosting in IIS v10 on Win Server 2016. I’ve tried clearing the browser cache but this still occurs.

Don’t personally use chrome myself. Do you still have these issues when you host your dashboard locally, not running through IIS?

P.S You also tried Chrome without extensions…?

I use Chrome or Edgium for pretty much everything so I doubt it’s a Chrome issue. I wonder if it has to do with HTTPS or something. I think we gotta try upgrading SignalR soon. It sounds like there are some fixes that might help resolve so weirdness like this.

I’d also be curious to hear if you see this issue when hosting locally as well as IIS.

I have no issues and am hosting in IIS 10.0 on windows server 2019

I thought this morning I’d test this without https.
Removed the 443 binding in IIS and disabled my http > https rewrite rule.
Restarted the app pool & site, cleared my local cache etc.
Everything is working as expected… so I’ve re-added everything back in and now I cant seem to replicate my issue again! For sure it’s an odd one. I’ll keep you updated, if I can replicate it again I’ll test hosting locally also.

Appreciate the feedback/advise.

1 Like

Just to throw some evidence in the mix, I am running UD on Ubuntu 18 & PSCore 6. I created a basic dashboard (via script) which calls another Powershell script for dynamic content. Three buttons. Press a button, and it runs that external script with a switch and returns a value in a Toast message. If I leave the page idle for a few minutes and then press a button I get the “Cannot send data […]” message. iOS, Android, FireOS (over Mobile Hotspot or WAN). Reloading page fixes connection. Desktop systems (WAN or Mobile Hotspot) seem to keep the connection alive much longer (Win10, Raspbian Buster, Chrome-based browsers). Might be related to client keep-alive rather than server?

1 Like