@@ -122,7 +122,15 @@ def subscription_changed(self, event: events.SubscriptionChangedEvent, context:
122122
123123 return PNTransition (
124124 state = HandshakingState ,
125- context = self ._context
125+ context = self ._context ,
126+ invocation = [
127+ invocations .EmitStatusInvocation (PNStatusCategory .PNSubscriptionChangedCategory ,
128+ operation = PNOperationType .PNSubscribeOperation ,
129+ context = self ._context ),
130+ invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
131+ operation = PNOperationType .PNSubscribeOperation ,
132+ context = self ._context ),
133+ ]
126134 )
127135
128136 def subscription_restored (self , event : events .SubscriptionRestoredEvent , context : PNContext ) -> PNTransition :
@@ -148,7 +156,7 @@ def reconnecting(self, event: events.HandshakeFailureEvent, context: PNContext)
148156
149157 return PNTransition (
150158 state = HandshakeReconnectingState ,
151- context = self ._context
159+ context = self ._context ,
152160 )
153161
154162 def disconnect (self , event : events .DisconnectEvent , context : PNContext ) -> PNTransition :
@@ -183,8 +191,14 @@ def unsubscribe_all(self, event: events.UnsubscribeAllEvent, context: PNContext)
183191 return PNTransition (
184192 state = UnsubscribedState ,
185193 context = self ._context ,
186- invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
187- operation = PNOperationType .PNUnsubscribeOperation )
194+ invocation = [
195+ invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory ,
196+ operation = PNOperationType .PNSubscribeOperation ,
197+ context = self ._context ),
198+ invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
199+ operation = PNOperationType .PNSubscribeOperation ,
200+ context = self ._context ),
201+ ]
188202 )
189203
190204
@@ -218,7 +232,10 @@ def disconnect(self, event: events.DisconnectEvent, context: PNContext) -> PNTra
218232
219233 return PNTransition (
220234 state = HandshakeStoppedState ,
221- context = self ._context
235+ context = self ._context ,
236+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory ,
237+ operation = PNOperationType .PNSubscribeOperation ,
238+ context = self ._context )
222239 )
223240
224241 def subscription_changed (self , event : events .SubscriptionChangedEvent , context : PNContext ) -> PNTransition :
@@ -230,7 +247,10 @@ def subscription_changed(self, event: events.SubscriptionChangedEvent, context:
230247
231248 return PNTransition (
232249 state = HandshakeReconnectingState ,
233- context = self ._context
250+ context = self ._context ,
251+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNSubscriptionChangedCategory ,
252+ operation = PNOperationType .PNSubscribeOperation ,
253+ context = self ._context )
234254 )
235255
236256 def handshake_reconnect (self , event : events .HandshakeReconnectFailureEvent , context : PNContext ) -> PNTransition :
@@ -240,7 +260,7 @@ def handshake_reconnect(self, event: events.HandshakeReconnectFailureEvent, cont
240260
241261 return PNTransition (
242262 state = HandshakeReconnectingState ,
243- context = self ._context
263+ context = self ._context ,
244264 )
245265
246266 def give_up (self , event : events .HandshakeReconnectGiveupEvent , context : PNContext ) -> PNTransition :
@@ -253,7 +273,7 @@ def give_up(self, event: events.HandshakeReconnectGiveupEvent, context: PNContex
253273 status_invocation = invocations .EmitStatusInvocation (status = event .reason .status .category ,
254274 operation = PNOperationType .PNUnsubscribeOperation )
255275 else :
256- status_invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory )
276+ status_invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNConnectionErrorCategory )
257277
258278 return PNTransition (
259279 state = HandshakeFailedState ,
@@ -305,7 +325,10 @@ def subscription_changed(self, event: events.SubscriptionChangedEvent, context:
305325
306326 return PNTransition (
307327 state = HandshakingState ,
308- context = self ._context
328+ context = self ._context ,
329+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNSubscriptionChangedCategory ,
330+ operation = PNOperationType .PNSubscribeOperation ,
331+ context = self ._context )
309332 )
310333
311334 def reconnect (self , event : events .ReconnectEvent , context : PNContext ) -> PNTransition :
@@ -340,8 +363,14 @@ def unsubscribe_all(self, event: events.UnsubscribeAllEvent, context: PNContext)
340363 return PNTransition (
341364 state = UnsubscribedState ,
342365 context = self ._context ,
343- invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
344- operation = PNOperationType .PNUnsubscribeOperation )
366+ invocation = [
367+ invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory ,
368+ operation = PNOperationType .PNSubscribeOperation ,
369+ context = self ._context ),
370+ invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
371+ operation = PNOperationType .PNSubscribeOperation ,
372+ context = self ._context ),
373+ ]
345374 )
346375
347376
@@ -374,8 +403,14 @@ def unsubscribe_all(self, event: events.UnsubscribeAllEvent, context: PNContext)
374403 return PNTransition (
375404 state = UnsubscribedState ,
376405 context = self ._context ,
377- invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
378- operation = PNOperationType .PNUnsubscribeOperation )
406+ invocation = [
407+ invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory ,
408+ operation = PNOperationType .PNSubscribeOperation ,
409+ context = self ._context ),
410+ invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
411+ operation = PNOperationType .PNSubscribeOperation ,
412+ context = self ._context ),
413+ ]
379414 )
380415
381416
@@ -412,7 +447,10 @@ def subscription_changed(self, event: events.SubscriptionChangedEvent, context:
412447
413448 return PNTransition (
414449 state = self .__class__ ,
415- context = self ._context
450+ context = self ._context ,
451+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNSubscriptionChangedCategory ,
452+ operation = PNOperationType .PNSubscribeOperation ,
453+ context = self ._context )
416454 )
417455
418456 def subscription_restored (self , event : events .SubscriptionRestoredEvent , context : PNContext ) -> PNTransition :
@@ -446,7 +484,7 @@ def receiving_failure(self, event: events.ReceiveFailureEvent, context: PNContex
446484 self ._context .timetoken = event .timetoken
447485 return PNTransition (
448486 state = ReceiveReconnectingState ,
449- context = self ._context
487+ context = self ._context ,
450488 )
451489
452490 def disconnect (self , event : events .DisconnectEvent , context : PNContext ) -> PNTransition :
@@ -477,8 +515,14 @@ def unsubscribe_all(self, event: events.UnsubscribeAllEvent, context: PNContext)
477515 return PNTransition (
478516 state = UnsubscribedState ,
479517 context = self ._context ,
480- invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
481- operation = PNOperationType .PNUnsubscribeOperation )
518+ invocation = [
519+ invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory ,
520+ operation = PNOperationType .PNSubscribeOperation ,
521+ context = self ._context ),
522+ invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
523+ operation = PNOperationType .PNSubscribeOperation ,
524+ context = self ._context ),
525+ ]
482526 )
483527
484528
@@ -515,7 +559,10 @@ def reconnect_failure(self, event: events.ReceiveReconnectFailureEvent, context:
515559
516560 return PNTransition (
517561 state = ReceiveReconnectingState ,
518- context = self ._context
562+ context = self ._context ,
563+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .UnexpectedDisconnectCategory ,
564+ operation = PNOperationType .PNSubscribeOperation ,
565+ context = self ._context )
519566 )
520567
521568 def subscription_changed (self , event : events .SubscriptionChangedEvent , context : PNContext ) -> PNTransition :
@@ -527,7 +574,10 @@ def subscription_changed(self, event: events.SubscriptionChangedEvent, context:
527574
528575 return PNTransition (
529576 state = ReceiveReconnectingState ,
530- context = self ._context
577+ context = self ._context ,
578+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNSubscriptionChangedCategory ,
579+ operation = PNOperationType .PNSubscribeOperation ,
580+ context = self ._context )
531581 )
532582
533583 def disconnect (self , event : events .DisconnectEvent , context : PNContext ) -> PNTransition :
@@ -546,7 +596,9 @@ def give_up(self, event: events.ReceiveReconnectGiveupEvent, context: PNContext)
546596 return PNTransition (
547597 state = ReceiveFailedState ,
548598 context = self ._context ,
549- invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory )
599+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNUnexpectedDisconnectCategory ,
600+ operation = PNOperationType .PNSubscribeOperation ,
601+ context = self ._context )
550602 )
551603
552604 def reconnect_success (self , event : events .ReceiveReconnectSuccessEvent , context : PNContext ) -> PNTransition :
@@ -602,7 +654,10 @@ def subscription_changed(self, event: events.SubscriptionChangedEvent, context:
602654
603655 return PNTransition (
604656 state = ReceivingState ,
605- context = self ._context
657+ context = self ._context ,
658+ invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNSubscriptionChangedCategory ,
659+ operation = PNOperationType .PNSubscribeOperation ,
660+ context = self ._context )
606661 )
607662
608663 def reconnect (self , event : events .ReconnectEvent , context : PNContext ) -> PNTransition :
@@ -637,8 +692,14 @@ def unsubscribe_all(self, event: events.UnsubscribeAllEvent, context: PNContext)
637692 return PNTransition (
638693 state = UnsubscribedState ,
639694 context = self ._context ,
640- invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
641- operation = PNOperationType .PNUnsubscribeOperation )
695+ invocation = [
696+ invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory ,
697+ operation = PNOperationType .PNSubscribeOperation ,
698+ context = self ._context ),
699+ invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
700+ operation = PNOperationType .PNSubscribeOperation ,
701+ context = self ._context ),
702+ ]
642703 )
643704
644705
@@ -671,8 +732,14 @@ def unsubscribe_all(self, event: events.UnsubscribeAllEvent, context: PNContext)
671732 return PNTransition (
672733 state = UnsubscribedState ,
673734 context = self ._context ,
674- invocation = invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
675- operation = PNOperationType .PNUnsubscribeOperation )
735+ invocation = [
736+ invocations .EmitStatusInvocation (PNStatusCategory .PNDisconnectedCategory ,
737+ operation = PNOperationType .PNSubscribeOperation ,
738+ context = self ._context ),
739+ invocations .EmitStatusInvocation (PNStatusCategory .PNAcknowledgmentCategory ,
740+ operation = PNOperationType .PNSubscribeOperation ,
741+ context = self ._context ),
742+ ]
676743 )
677744
678745
0 commit comments