Add websocket feature (#3562)

* add websocket feature

* Added 2.7.0_min_version
This commit is contained in:
ctrlaltca 2019-02-06 09:08:59 +01:00 committed by Zach H
parent 073c531855
commit 46b34d6515
3 changed files with 14 additions and 8 deletions

View file

@ -23,7 +23,10 @@ void FeatureSet::initalizeFeatureList(QMap<QString, bool> &featureList)
featureList.insert("mod_log_lookup", false); featureList.insert("mod_log_lookup", false);
featureList.insert("idle_client", false); featureList.insert("idle_client", false);
featureList.insert("forgot_password", false); featureList.insert("forgot_password", false);
featureList.insert("2.6.1_min_version", false); // This is temp to force users onto a newer client featureList.insert("websocket", false);
// These are temp to force users onto a newer client
featureList.insert("2.6.1_min_version", false);
featureList.insert("2.7.0_min_version", false);
} }
void FeatureSet::enableRequiredFeature(QMap<QString, bool> &featureList, QString featureName) void FeatureSet::enableRequiredFeature(QMap<QString, bool> &featureList, QString featureName)

View file

@ -73,7 +73,7 @@ requireclientid=false
; You can limit the types of clients that connect to the server by requiring different features be available ; You can limit the types of clients that connect to the server by requiring different features be available
; on the client. This setting can contain a comma-seperated list of features. if any of the features ; on the client. This setting can contain a comma-seperated list of features. if any of the features
; listed in this line are not available on the client the client will be denied access to the server upon ; listed in this line are not available on the client the client will be denied access to the server upon
; attempting to log in. Example: "client_id,client_ver" ; attempting to log in. Example: "client_id,client_ver,websocket"
requiredfeatures="" requiredfeatures=""
; You can define custom warnings that users are sent when the moderation staff uses the right client warn user ; You can define custom warnings that users are sent when the moderation staff uses the right client warn user

View file

@ -86,7 +86,7 @@ var WebClient = {
resetConnectionvars : function () { resetConnectionvars : function () {
this.cmdId = 0; this.cmdId = 0;
this.pendingCommands = {}; this.pendingCommands = {};
}, },
sendCommand : function (cmd, callback) sendCommand : function (cmd, callback)
@ -151,7 +151,7 @@ var WebClient = {
WebClient.sendSessionCommand(sc, function() { WebClient.sendSessionCommand(sc, function() {
WebClient.lastPingPending = false; WebClient.lastPingPending = false;
}); });
}, WebClient.options.keepalive); }, WebClient.options.keepalive);
}, },
@ -168,6 +168,9 @@ var WebClient = {
"feature_set", "feature_set",
"room_chat_history", "room_chat_history",
"client_warnings", "client_warnings",
"websocket",
"2.6.1_min_version",
"2.7.0_min_version",
/* unimplemented features */ /* unimplemented features */
"forgot_password", "forgot_password",
"idle_client", "idle_client",
@ -404,7 +407,7 @@ var WebClient = {
this.socket.onclose = function() { this.socket.onclose = function() {
WebClient.setStatus(StatusEnum.DISCONNECTED, 'Connection closed'); WebClient.setStatus(StatusEnum.DISCONNECTED, 'Connection closed');
} }
this.socket.onerror = function() { this.socket.onerror = function() {
WebClient.setStatus(StatusEnum.DISCONNECTED, 'Connection failed'); WebClient.setStatus(StatusEnum.DISCONNECTED, 'Connection failed');
@ -412,7 +415,7 @@ var WebClient = {
this.socket.onopen = function(){ this.socket.onopen = function(){
WebClient.setStatus(StatusEnum.CONNECTED, 'Connected'); WebClient.setStatus(StatusEnum.CONNECTED, 'Connected');
} }
this.socket.onmessage = function(event) { this.socket.onmessage = function(event) {
//console.log("Received " + event.data.byteLength + " bytes"); //console.log("Received " + event.data.byteLength + " bytes");
@ -431,7 +434,7 @@ var WebClient = {
{ {
str += String.fromCharCode(uint8msg[i]); str += String.fromCharCode(uint8msg[i]);
} }
console.log(str); console.log(str);
} }
return; return;
} }
@ -456,7 +459,7 @@ var WebClient = {
WebClient.processRoomEvent(msg.roomEvent); WebClient.processRoomEvent(msg.roomEvent);
break; break;
} }
} }
}, },
disconnect : function() { disconnect : function() {