File tree Expand file tree Collapse file tree 5 files changed +14
-43
lines changed Expand file tree Collapse file tree 5 files changed +14
-43
lines changed Original file line number Diff line number Diff line change 1+ <a name =" 1.0.5 " ></a >
2+ ## [ 1.0.5] ( https://github.com/adonisjs/adonis-websocket-client/compare/v1.0.4...v1.0.5 ) (2018-03-16)
3+
4+
5+
16<a name =" 1.0.4 " ></a >
27## [ 1.0.4] ( https://github.com/adonisjs/adonis-websocket-client/compare/v1.0.0...v1.0.4 ) (2018-03-16)
38
Original file line number Diff line number Diff line change 11{
22 "name" : " @adonisjs/websocket-client" ,
3- "version" : " 1.0.4 " ,
3+ "version" : " 1.0.5 " ,
44 "description" : " Websocket client for AdonisJs" ,
55 "main" : " dist/Ws.es.js" ,
66 "module" : " dist/Ws.es.js" ,
Original file line number Diff line number Diff line change @@ -263,40 +263,20 @@ export default class Connection extends Emitter {
263263 * @private
264264 */
265265 _onClose ( event ) {
266- this . ws = null
267266 clearInterval ( this . _pingTimer )
268- this . _pingTimer = null
269267
270- /**
271- * Terminate completely
272- */
273- if ( ! this . shouldReconnect ) {
274- this . _subscriptionsIterator ( ( subscription ) => subscription . terminate ( ) )
275- this
276- . emit ( 'close' , this )
277- . then ( ( ) => {
278- this . clearListeners ( )
279- } )
280- . catch ( ( ) => {
281- this . clearListeners ( )
282- } )
283- return
284- }
268+ this . ws = null
269+ this . _pingTimer = null
285270
286- /**
287- * Keep subscriptions in pending state
288- */
289- this . _subscriptionsIterator ( ( subscription ) => subscription . reconnecting ( ) )
271+ this . _subscriptionsIterator ( ( subscription ) => subscription . terminate ( ) )
290272
291- /**
292- * Emit close and then reconnect
293- */
294273 this
295274 . emit ( 'close' , this )
296275 . then ( ( ) => {
297- this . _reconnect ( )
298- } ) . catch ( ( ) => {
299- this . _reconnect ( )
276+ this . shouldReconnect ? this . _reconnect ( ) : this . clearListeners ( )
277+ } )
278+ . catch ( ( ) => {
279+ this . shouldReconnect ? this . _reconnect ( ) : this . clearListeners ( )
300280 } )
301281 }
302282
@@ -611,7 +591,6 @@ export default class Connection extends Emitter {
611591 * Sending join request to the server, the subscription will
612592 * be considered ready, once server acknowledges it
613593 */
614- console . log ( 'this._connectionState' , this . _connectionState )
615594 if ( this . _connectionState === 'open' ) {
616595 this . sendPacket ( wsp . joinPacket ( topic ) )
617596 }
Original file line number Diff line number Diff line change @@ -211,19 +211,6 @@ export default class Socket {
211211 this . state = 'error'
212212 }
213213
214- /**
215- * Connection is trying to reconnect with the server,
216- * so we have to move subscription to pending state
217- *
218- * @method reconnecting
219- *
220- * @return {void }
221- */
222- reconnecting ( ) {
223- this . state = 'pending'
224- this . emitter . emit ( 'close' , this )
225- }
226-
227214 /**
228215 * Sends the request on server to close the subscription, we
229216 * have to wait for acknowledgment too
You can’t perform that action at this time.
0 commit comments