mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
fix error reconnect when using long polling
This commit is contained in:
parent
82f749e21f
commit
a197942d66
2 changed files with 42 additions and 26 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*static version*/
|
||||
var ws=null;
|
||||
var adr;
|
||||
var adr; var adrc;
|
||||
var clog={};
|
||||
var pingerid;
|
||||
var s = document.location.search;
|
||||
|
|
@ -89,14 +89,16 @@ function Open_ws() {
|
|||
if (location.port != '') { adr = adr + ':' + location.port; }
|
||||
adr = adr + '/clog';
|
||||
|
||||
if (clog['connection_id']) { adr = adr + '?r=' + clog['connection_id'] }
|
||||
if (clog['connection_id']) {
|
||||
adrc = adr + '?r=' + clog['connection_id'];
|
||||
} else { adrc = adr }
|
||||
|
||||
try {
|
||||
console.log ('connecting to ' + adr);
|
||||
ws = new WebSocket (adr);
|
||||
console.log ('connecting to ' + adrc);
|
||||
ws = new WebSocket (adrc);
|
||||
} catch (e) {
|
||||
console.log ('trying again, connecting to ' + adr);
|
||||
ws = new WebSocket (adr);
|
||||
console.log ('trying again, connecting to ' + adrc);
|
||||
ws = new WebSocket (adrc);
|
||||
}
|
||||
|
||||
if (ws != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue