not all websockets are versioned

mixed-cache-boot
Thibault Duplessis 2017-01-23 10:05:28 +01:00
parent fdf3a7558f
commit 349c038d0d
3 changed files with 8 additions and 7 deletions

View File

@ -215,7 +215,7 @@ $(function() {
$('.lag .answer span').hide().parent().find('.' + c).show();
};
lichess.socket = new lichess.StrongSocket('/socket', 0, {
lichess.socket = new lichess.StrongSocket('/socket', false, {
options: {
name: "analyse",
onFirstConnect: function() {

View File

@ -449,7 +449,7 @@ lichess.notifyApp = (function() {
}
setTimeout(function() {
if (lichess.socket === null) lichess.socket = lichess.StrongSocket("/socket", 0);
if (lichess.socket === null) lichess.socket = lichess.StrongSocket("/socket", false);
}, 300);
// themepicker
@ -1349,7 +1349,7 @@ lichess.notifyApp = (function() {
var analyse;
cfg.initialPly = 'url';
cfg.element = element.querySelector('.analyse');
lichess.socket = lichess.StrongSocket('/socket', 0, {
lichess.socket = lichess.StrongSocket('/socket', false, {
options: {
name: "analyse"
},
@ -1409,7 +1409,7 @@ lichess.notifyApp = (function() {
var analyse;
cfg.element = element.querySelector('.analyse');
cfg.sideElement = document.querySelector('#site_header .side_box');
lichess.socket = lichess.StrongSocket('/socket', 0, {
lichess.socket = lichess.StrongSocket('/socket', false, {
options: {
name: "practice"
},
@ -1433,7 +1433,7 @@ lichess.notifyApp = (function() {
var puzzle;
cfg.element = document.querySelector('#puzzle');
cfg.sideElement = document.querySelector('#site_header .puzzle_side');
lichess.socket = lichess.StrongSocket('/socket', 0, {
lichess.socket = lichess.StrongSocket('/socket', false, {
options: {
name: "puzzle"
},

View File

@ -12,6 +12,7 @@ lichess.StrongSocket = function(url, version, settings) {
var settings = $.extend(true, {}, lichess.StrongSocket.defaults, settings);
var url = url;
var version = version;
var versioned = version !== false;
var options = settings.options;
var ws = null;
var pingSchedule = null;
@ -146,10 +147,10 @@ lichess.StrongSocket = function(url, version, settings) {
};
var pingData = function() {
return JSON.stringify({
return versioned ? JSON.stringify({
t: "p",
v: version
});
}) : '{"t":"p"}';
};
var handle = function(m) {