@@ -35,7 +35,7 @@ var ClexiJS = (function(){
3535
3636 Clexi . availableXtensions = { } ; //TODO: we should update this somehow (will only update once at welcome event)
3737
38- Clexi . pingAndConnect = function ( host , onPingOrIdError , onOpen , onClose , onError , onConnecting ) {
38+ Clexi . pingAndConnect = function ( host , onPingOrIdError , onOpen , onClose , onError , onConnecting , onWelcome ) {
3939 var url ;
4040 if ( ! host ) url = location . origin ;
4141 else url = host . replace ( / ^ w s s / , 'https' ) . replace ( / ^ w s / , 'http' ) ;
@@ -47,7 +47,7 @@ var ClexiJS = (function(){
4747 //console.log(data);
4848 //check ID
4949 if ( data . id && ( data . id == Clexi . serverId || ( data . id == "[SECRET]" && Clexi . serverId ) ) ) {
50- Clexi . connect ( host , onOpen , onClose , onError , onConnecting ) ;
50+ Clexi . connect ( host , onOpen , onClose , onError , onConnecting , onWelcome ) ;
5151 } else {
5252 if ( onPingOrIdError ) onPingOrIdError ( {
5353 code : 418 ,
@@ -168,7 +168,7 @@ var ClexiJS = (function(){
168168 if ( ! requestedClose ) {
169169 //try reconnect?
170170 if ( Clexi . doAutoReconnect ) {
171- autoReconnect ( host , onOpen , onClose , onError , onConnecting ) ;
171+ autoReconnect ( host , onOpen , onClose , onError , onConnecting , onWelcome ) ;
172172 }
173173 } else {
174174 if ( reconnectTimer ) clearTimeout ( reconnectTimer ) ;
@@ -185,15 +185,15 @@ var ClexiJS = (function(){
185185 }
186186 }
187187
188- function autoReconnect ( host , onOpen , onClose , onError , onConnecting ) {
188+ function autoReconnect ( host , onOpen , onClose , onError , onConnecting , onWelcome ) {
189189 reconnectTry ++ ;
190190 var delay = Math . min ( reconnectTry * reconnectTry * reconnectBaseDelay , reconnectMaxDelay ) ;
191191 //TODO: we could/should check navigator.onLine here ...
192192 if ( reconnectTimer ) clearTimeout ( reconnectTimer ) ;
193193 reconnectTimer = setTimeout ( function ( ) {
194194 if ( ! isConnected && ! requestedClose ) {
195195 if ( Clexi . onLog ) Clexi . onLog ( 'CLEXI reconnecting after unexpected close. Try: ' + reconnectTry ) ;
196- Clexi . connect ( host , onOpen , onClose , onError , onConnecting ) ;
196+ Clexi . connect ( host , onOpen , onClose , onError , onConnecting , onWelcome ) ;
197197 }
198198 } , delay ) ;
199199 }
0 commit comments