3

I am using PocketSocket as a LAN WebSocket server (on port 8080) on iOS and I connect to it using javascript.

Here is the javascript code:

var address = 'ws://' + window.location.host + ':8080/ws';
client = new WebSocket( address );

I have tested the connection using the fallowing browsers: Chrome (Windows and OS X), Safari (OS X and iPhone), Opera (Windows), Android Browser, the browser on Panasonic TV.

The only browser that it failed was Firefox (Windows and OS X). I have tried multiple versions of Firefox from version 5 to 40. I have also tried using MozWebSocket, but at no avail.

The error that I get is:

    Firefox can't establish a connection to the server at ws://192.168.0.100:8080/ws.

    The connection to ws://192.168.0.100:8080/ws was interrupted while the page was loading.

What is different in Firefox from the other browsers? Do you have any suggestions?

Andrei Ardelean
  • 474
  • 4
  • 12
  • ..and it's not the same as this: http://stackoverflow.com/questions/14140414/websocket-interrupted-while-page-is-loading-on-firefox-for-socket-io ? – adelphus Jul 25 '15 at 14:31
  • In that case the Websocket is interrupted when the page is refreshed on firefox, in my case the websocket doesn't connect at all. In my case i am pretty sure that the problem lies with the Websocket server implementation in objective c. – Andrei Ardelean Jul 25 '15 at 16:20
  • In that case the problem does not appear to be browser related. In my case the websocket fails only firefox, I could not find any other browser in which it fails – Andrei Ardelean Jul 25 '15 at 16:24

1 Answers1

2

The problem had to do with "Sec-WebSocket-Extensions: permessage-deflate". Setting network.websocket.extensions.permessage-deflate to false in about:config inside Firefox solved the problem.

Also disabling permessage-deflate from the websocket server would fix the problem.

Andrei Ardelean
  • 474
  • 4
  • 12