Change alt socket to socketio xhr-polling

This commit is contained in:
calzoneman 2013-07-13 16:15:57 -04:00
parent 07795feffa
commit 5a5016fd79
4 changed files with 17 additions and 39 deletions

View File

@ -1001,12 +1001,7 @@ setupCallbacks = function() {
}
}
if(USEROPTS.altsocket) {
socket = new NotWebsocket();
setupCallbacks();
}
else {
$.getScript(IO_URL+"/socket.io/socket.io.js", function() {
$.getScript(IO_URL+"/socket.io/socket.io.js", function() {
try {
if(NO_WEBSOCKETS) {
var i = io.transports.indexOf("websocket");
@ -1019,5 +1014,4 @@ else {
catch(e) {
Callbacks.disconnect();
}
});
}
});

View File

@ -21,6 +21,7 @@ var CLIENT = {
text: ""
}
};
var SUPERADMIN = false;
var CHANNEL = {
opts: {},
@ -113,6 +114,8 @@ var USEROPTS = {
ignore_channeljs : getOrDefault("ignore_channeljs", false)
};
var NO_WEBSOCKETS = USEROPTS.altsocket;
var Rank = {
Guest: 0,
Member: 1,

View File

@ -11,4 +11,3 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var IO_URL = "http://localhost:1337";
var WEB_URL = "http://localhost:8080";
var NO_WEBSOCKETS = false;

View File

@ -478,7 +478,7 @@ function showOptionsMenu() {
addOption("Send Button", sendbtncontainer);
var altsocketcontainer = $("<label/>").addClass("checkbox")
.text("Use alternative socket connection");
.text("Use alternative socket connection (requires refresh)");
var altsocket = $("<input/>").attr("type", "checkbox")
.appendTo(altsocketcontainer);
altsocket.prop("checked", USEROPTS.altsocket);
@ -594,24 +594,6 @@ function applyOpts() {
}
});
}
if(USEROPTS.altsocket) {
if(!socket.nws) {
if(socket && socket.disconnect)
socket.disconnect();
socket = new NotWebsocket();
setupCallbacks();
}
}
// Switch from NotWebsocket => Socket.io
else if(socket && typeof socket.poll !== "undefined") {
try {
socket = io.connect(IO_URL);
setupCallbacks();
}
catch(e) {
}
}
}
applyOpts();