mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Fix parsing of server version.
This commit is contained in:
parent
1ad91adf89
commit
892a4b8401
1 changed files with 5 additions and 4 deletions
|
@ -298,7 +298,7 @@ ServerConnection.prototype.connect = async function(url) {
|
|||
this.socket.onopen = function(e) {
|
||||
sc.send({
|
||||
type: 'handshake',
|
||||
version: ["2"],
|
||||
version: ['2'],
|
||||
id: sc.id,
|
||||
});
|
||||
if(sc.onconnected)
|
||||
|
@ -332,9 +332,10 @@ ServerConnection.prototype.connect = async function(url) {
|
|||
let m = JSON.parse(e.data);
|
||||
switch(m.type) {
|
||||
case 'handshake': {
|
||||
if(m.version === "2")
|
||||
sc.version = m.version;
|
||||
else {
|
||||
if((m.version instanceof Array) && m.version.includes('2')) {
|
||||
sc.version = '2';
|
||||
} else {
|
||||
sc.version = null;
|
||||
console.error(`Unknown protocol version ${m.version}`);
|
||||
throw new Error(`Unknown protocol version ${m.version}`);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue