Is there a known issue with Safari-8 and WebSockets? - javascript

I've installed the Yosemite preview and WebSockets don't work for me on Safari 8.
The echo test page works on Chrome (with the secure checkbox set) but when I try with Safari it fails silently.
I debugged the page and what happens is that the WebSocket is created but its onopen event is not fired and the socket's readyState status remains stuck on CONNECTING (0).
I couldn't find any references to this problem, is there any configuration I may have missed that causes/fixes this?

Safari has updated (to version 8.0.10600.1.22) and the problem is now resolved.

Related

How to debug websocket connection error with "Unknown reason"

Recently, I am getting the following message on chrome console;
WebSocket connection to 'ws://evo15:4008/?stream' failed: Unknown reason
It's getting more and more and it's somehow annoying and I have to open a new tab or restart chrome every time to get back to normal websocket connection. How can I debug it? Unfortunately, I cannot reproduce it yet. My chrome version is Version 77.0.3865.75 (Official Build) (64-bit)
Update 1: I think you could reproduce it by closing the connection for a long time (I don't know the exact time) from server side and then open it and try to connect to it (client trys to connect every 1 sec). Then it will happen. So I guess there is an expire time or a limited number of tries to connect somewhere.
Update 2: It happens after 256 tries of reconnection.
WebSocket connection to 'ws://evo15:4008/?stream' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
After seeing 255 of this error on console, you will see the first error and cannot reconnect. So I think there is a 8 bit limit somewhere that I am missing
Looks like someone just filed this as a Chromium (v77) bug. See issue tracking it here.
Update 1: As noted in the issue tracker and comments below, this should now be fixed in the latest stable release, which is being rolled out now (2019/10/11).
Update 2: Despite the bug being marked as fixed/closed in monorail, canary (80.0.3977.4) still appears to have this behavior. As others have noted there is a global limit of 255. However, the fact that connections opened by JS don't get closed/reset when the page is refreshed still seems like a bug to me.
For some very very very odd reason in my computer the websocket connection was considered as an ad by AdBlock.
Try to disable AdBlock and see if it works.

XHR Post aborted in Firefox > 44, Safari and IE, but always Works in Chrome

I have a piece of Javascript fully tested and working in many different environments. In this new environment I'm currently facing, this script does not work even using the same browsers.
The problem is the following: this script does and XHR Post to a certain URL (in the same domain) but in Firefox 46 (it DOES work in firefox 43 and 44) and Safari I see in the network monitor "Aborted". In IE randomly works, otherwise remains in pending. It always works in Chrome.
Trying to debug the problem I used Fiddler, but Fiddler seems to solve the problem with all the browsers.
The website is in HTTPS, but I don't think it's an HTTPS related problem because I can directly access to the resource and I can successfully do the same POST with CURL.
It also seems to be a Client Side problem because with Whireshark I can't even see the begin of the request. It seems like the browser drops the XHR POST even before starting it.
What can be the root of this problem? What changed between firefox 44 and 46 regarding the handling of HTTP POST request?
Thanks in advance.
PS: unfortunately I cannot share the code. Anyway, since it does works in different infrastractures, maybe is not needed.
UPDATE1: I just noticed that if I wait a couple of seconds (around 30) and I do "Edit and resend" from the network monitor, the request is correctly sent. If i try before that windowd time I see the "aborted" error
This seems to be a bug in Firefox 46: http://forums.mozillazine.org/viewtopic.php?f=25&t=3005573
I just upgraded to Firefox 47, and it appears to be solved now.
thank you for your answer. You were right about Firefox, in fact I upgraded to 47 too and it was solved. Anyway the problem was still present for IE and Safari. I found as a solution, valid for all browsers, enabling the One Connect feature on the Big-IP F5 load balancer. Unfortunately it wasn't something managed by me and I hadn't access to this kind of configuration to do some tests by myself
I hope this information can be useful to someone else encountering the same problem

Chrome SecurityError loading jQuery Mobile page from local file system

I get the following error in Chrome when loading a trivially simple html file with a jQuery Mobile reference. The error is not present with just the jQuery reference.
Uncaught SecurityError: Failed to execute 'replaceState' on 'History':
A history state object with URL 'http://stacksnippets.net/js' cannot
be created in a document with origin 'null'.
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>
</head>
<body></body>
</html>
You can also "Run code snippet" and see the error in the console.
This error did not happen before today. I have not changed my code or method of loading the html file in the browser. It used to work perfectly - I use the same code for all my PhoneGap apps.
Does anyone know if there was a Chrome security update that causes this SecurityError or whether I'm missing something? How would you go about debugging this? Thank you.
UPDATE
This discussion I think points out what is going on, which I suspected, since the error does not appear when running with a web server: Origin null is not allowed by Access-Control-Allow-Origin .
But I am still wondering why this changed in the past day, whether Chrome has had a change in their security policy, or why it was working before, and whether any of my PhoneGap apps will be affected.
This error is same as the origin is null error. This error occurs because of the security feature of Chrome.
A simple solution to test the application is to bypass this security on chrome.
Steps:
create a chrome browser shortcut on desktop.
Close all the instances of chrome on your machine.
Right click on the desktop shortcut of chrome and click on Properties.
in Target field, append " -allow-file-access-from-files" at the end.
Save and close properties.
Open chrome via this shortcut only.
Hurry, the error has gone. App works perfectly.
NOTE: This is just a work-around I use to test my cordova apps on desktop browser for UI testing.
Temporary solution: I've commented out all history.replaceState calls in jquery mobile, didn't need to manipulate browser history in my app anyways.
I wonder if it's chrome security bug or model and future behavior.
On a Mac I was able to fix this by running a webserver instead of loading it from a "file://" url:
http://lifehacker.com/start-a-simple-web-server-from-any-directory-on-your-ma-496425450?utm_expid=66866090-49.VYy4WCNHSyuP6EmjnM93MQ.0&utm_referrer=https%3A%2F%2Fwww.google.com%2F
python -m SimpleHTTPServer 8000
In the directory should make it available from Chrome via 0.0.0.0
I don't seem to have the same problem, not on the stable version of Chrome (45) or the Dev version (47).
However, I have personally seen issues with the CORS header, too. If you can cause the problem to happen reliably, I suggest filing a bug at crbug.com and a Chrome developer will have a look at it.

Firefox 29.0.1 WebSocket problems

Has anyone managed to use websockets with latest firefox (29.0.1). Connection is established but no messages are sent to the server or received from the server.
Also tried to run http://www.websocket.org/echo.html example against my server and websocket.org but nothing. Everything works perfectly in older firefox and chrome.
Does anyone know what could cause it?
You have to enable the websocket:
open about:config in firefox toolbar as:
then setting the network.websocket.enabled preferences to true
Finally re-try to http://www.websocket.org/echo.html

Servicestack-SwaggerUI crashes on IE<10 for method "defineproperty" not found

I'm using SwaggerUI over a Servicestack v4.07(licensed) application to expose REST specs.
Everything works on Firefox and Chrome, but when i try to open the swagger index with IE9 or below, it crashes, showing nothing but the page header, so no service is listed.
Actually i can reproduce this but even on the swagger demo website http://petstore.swagger.wordnik.com/
When i open it with IE9 it crashes because of a (probably) known issue: https://github.com/wordnik/swagger-ui/pull/204.
When i open it with IE8 instead the fiddler tells me that there's no such defineProperties method for the Object class(exception raised from shred.bundle.js)
Does someone know about such issues?

Categories

Resources