I am working on a railo site on websocket. Have installed the plugin for the websocket. It is working fine when I run this as localhost.
But when I run my site as https://www.example.net, it is throwing an error like "SecurityError: The operation is insecure."
Then I have changed the websocket connection port URL from ws://example.net:10125 to wss://example.net:10125 the error become "Firefox can't establish a connection to the server at wss://example.net:10125/.".
This is the code i am using to connect with websocket
simple_chat.connect = function(){
if(!simple_chat.validate_connection()){
return;
}
var server_url = 'ws://example.net:10125';
var nickname = 'user_name';
//enable
var ids_to_enable = ['disconnect','message_box','send'];
for(var i = 0; i < ids_to_enable.length; i++){
$('#' + ids_to_enable[i]).attr('disabled',false);
}
//disable
var ids_to_disable = ['connect','server_url','nickname'];
for(var i = 0; i < ids_to_disable.length; i++){
$('#' + ids_to_disable[i]).attr('disabled','disabled');
}
simple_chat.new_websocket();
}
simple_chat.new_websocket = function(){
var server_url = 'ws://example.net:10125';
simple_chat.ws = new WebSocket(server_url);
simple_chat.ws.onopen = function(){
}
simple_chat.ws.onmessage = function(message){
console.log(message);
}
simple_chat.ws.onclose = function(){
var text = 'Left the chat';
simple_chat.log_message(simple_chat.format_message('You',text));
simple_chat.ws.send(simple_chat.format_message(simple_chat.nickname(),text));
}
}
Can anyone help me on this?