signalR Disconnect in client browser after a while - javascript

I am using SignalR in asp.net core and it work correctly in visual studio but when i publish it to iis an when connect to server after a while signalR disconnect and browser show blow errors:
[2019-09-24T18:46:05.446Z] Error: Connection disconnected with error 'Error: Error occurred'.
Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
signalr.js:2678 [2019-09-24T18:46:05.711Z] Error: Connection disconnected with error 'Error: Error occurred'.
Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
signalr.js:2678 [2019-09-24T18:46:05.713Z] Error: Connection disconnected with error 'Error: Error occurred'.
Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING

Normally signalr have connection time out so you need to let signalr know you want to have long polling connection by setting this in your code
connection.start({ transport: 'longPolling' });

Related

What is error net::ERR_CONNECTION_REFUSED?

Failed to load resource:
net::ERR_CONNECTION_REFUSED?
It means exactly what it says.
You tried to connect to something over the network. The system you were connecting to refused to accept the connection.
Usually this is because there isn't a service listening on the port you tried to connect to. Sometimes the connection is blocked by a firewall.

How to connect SSL websocket with mqtt?

I created a self signed certificate and I've been working on the mqtt websockets over SSL/TSL, however I'm unsure exactly where I made an error. On my terminal websocket is open and sends out CONNACK/SUBSCRIBE/PUBLISH etc...
However when I opened up my chrome console log, I got an error saying that
"websocket connection to 'wss:.//hostname:9001/mqtt' failed: Error in connection establishment: net: ERR_CERT_AUTHORITY_INVALID
My time is synchronised correctly, and I'm either thinking my certificate has an error or chrome doesn't accept it but if my certificate error, wouldn't it have given an error when I first tried it on regular mosquitto_sub?
Any tips?
Thank you

An SSL certificate error occurred when fetching the script. (messaging/failed-serviceworker-registration)

I am testing my web app on localhost for firebase cloud messaging.
I am running it on a virtual host and I enabled SSL for it, I can see https but it is crossed in red. I searched and tried two methods but none of them are working
.\chrome.exe --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://firebase_notification.test
Also,
chrome://flags/#allow-insecure-localhost enable this flag
I am still getting the same error.
An SSL certificate error occurred when fetching the script.
get-notifications:57 An error occurred while retrieving token. FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script. (messaging/failed-serviceworker-registration).
at https://www.gstatic.com/firebasejs/6.3.4/firebase-messaging.js:1:30787

How to get NET errors in Javascript

When using WebSocket to open my wss I sometimes see in the browser console ...
foo.js:557 WebSocket connection to 'wss://:9002/changes' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID
Other times I see...
WebSocket connection to 'wss://:9002/changes' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
However, in either case the onclose event is code 1006. Is there anyway in JavaScript I can differentiate between the invalid certificate and the down connection?

Flask-SocketIO not connecting to WebSocket after deploying to Heroku

I am trying to create a real-time chatroom application using Flask-SocketIO. The app seems to work as intended when running on my local machine, however after deploying the app to Heroku the websocket won't connect and I get two errors:
WebSocket connection to 'wss://cs50flack.herokuapp.com/socket.io/?
EIO=3&transport=websocket&sid=8f8e233608794661a113fadc5418c27f' failed:
Error during WebSocket handshake: Unexpected response code: 400
and:
GET https://cs50flack.herokuapp.com/socket.io/?
EIO=3&transport=polling&t=1546556762105-
66&sid=b17b8d48610842fca97cbac3e030f3bd 400 (BAD REQUEST)
code: https://github.com/r0ss26/Flack
URL: https://cs50flack.herokuapp.com/

Categories