I want to connect to my web socket, which will add an amazone instance with some ip. I can connect my web socket with some ip and port with google rest client application and it works very well. Screenshot: 
But if I want to associate this with a java script, it will not be able to connect. It works up to 2-3 months. I have not changed and nothing, but now it does not work. If I want to connect to firefox, this will result in an error. Here is my code: -
function init() { var host = "ws://XX.XX.XXX.XXX:XXXX"; // SET THIS TO YOUR SERVER try { var socket = new WebSocket(host); // alert('WebSocket - status ' + socket.readyState); log('WebSocket - status ' + socket.readyState); socket.onopen = function (msg) { alert('open'); alert("Welcome - status " + this.readyState); log("Welcome - status " + this.readyState); if (this.readyState != 1) { reconnect(); } }; socket.onmessage = function (msg) { // alert("Received: " + msg.data); log("Received: " + msg.data); }; socket.onclose = function (msg) { // alert("Disconnected - status " + this.readyState); log("Disconnected - status " + this.readyState); }; } catch (ex) { alert(ex); log(ex); } $("msg").focus(); }
This is the alert status 0 and error display in the console: -
Firefox can't establish a connection to the server at ws:
source share