File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 4040 * onopen // sometime later...
4141 * onmessage
4242 * onmessage
43- * etc...
43+ * etc...
4444 *
4545 * It is API compatible with the standard WebSocket API, apart from the following members:
4646 *
124124 if ( self . debug || ReconnectingWebSocket . debugAll ) {
125125 console . debug ( 'ReconnectingWebSocket' , 'attempt-connect' , url ) ;
126126 }
127-
127+
128128 var localWs = ws ;
129129 var timeout = setTimeout ( function ( ) {
130130 if ( self . debug || ReconnectingWebSocket . debugAll ) {
134134 localWs . close ( ) ;
135135 timedOut = false ;
136136 } , self . timeoutInterval ) ;
137-
137+
138138 ws . onopen = function ( event ) {
139139 clearTimeout ( timeout ) ;
140140 if ( self . debug || ReconnectingWebSocket . debugAll ) {
148148 reconnectAttempt = false ;
149149 eventTarget . dispatchEvent ( e ) ;
150150 } ;
151-
151+
152152 ws . onclose = function ( event ) {
153153 clearTimeout ( timeout ) ;
154154 ws = null ;
209209 * If the connection is already CLOSED, this method does nothing.
210210 */
211211 this . close = function ( code , reason ) {
212+ // Default CLOSE_NORMAL code
213+ if ( typeof code == 'undefined' ) {
214+ code = 1000 ;
215+ }
212216 forcedClose = true ;
213217 if ( ws ) {
214218 ws . close ( code , reason ) ;
You can’t perform that action at this time.
0 commit comments