2012-05-06, 11:44
That's funny. I was just about to post I was having problems. I've been trying on and off for a few days, I'm doing basically the same thing but I don't get a connection. It tries to open and then after a while I get a closed message and error "Firefox can't establish a connection to the server at ws://10.0.0.101:9090/jsonrpc". Here is the simple code:
I can't see what I'm doing wrong. Seems rather simple... I've allowed everything in network just in case. Any ideas? I've tried FF and Chrome.
EDIT: Just thought I'd try the websocket.org demo. Works in Chrome but not in FF. Error in log:
EDIT, EDIT: Okay and now Chrome is working fine. Maybe because I just allowed UPnP access?
I'll leave all this here for any searchers it might help.
Code:
wsListener: function() {
if ("WebSocket" in window) {
var wsConn = 'ws://' + location.hostname + ':9090/jsonrpc';
console.log(wsConn);
var ws = new WebSocket(wsConn);
console.log(ws);
ws.onopen = function (e) {
console.log('socket open');
ws.send('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties" : ["thumbnail"]}, "id": 1}');
};
ws.onerror = function (err) {
console.log(err);
};
ws.onmessage = function (e) {
console.log(e.data);
};
ws.onclose = function (e) {
console.log('socket close');
};
};
}
EDIT: Just thought I'd try the websocket.org demo. Works in Chrome but not in FF. Error in log:
Code:
10:39:44 T:2874841968 INFO: WebSocket [RFC6455]: invalid "connection" received
10:39:44 T:2874841968 INFO: WebSocket: No frame expected in the current state
EDIT, EDIT: Okay and now Chrome is working fine. Maybe because I just allowed UPnP access?
I'll leave all this here for any searchers it might help.