- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.6k
 
[dotnet][bidi] Use subscription id for events to unsubscribe #15251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
          PR Reviewer Guide 🔍(Review updated until commit b67ebbc)Here are some key observations to aid the review process: 
  | 
    
          PR Code Suggestions ✨Latest suggestions up to b67ebbc 
 Previous suggestions✅ Suggestions up to commit 4ecab12
  | 
    
| 
           Now I should to recall everything in events mechanism to understand whether it can be even more simplified.  | 
    
| 
           Per slack channel: 
 Can we add tests on FF? Can we even run this code yet?  | 
    
| 
           PR is draft, so just waiting when v134 is released.  | 
    
| 
           Negotiated, works with both v133 and v134.  | 
    
User description
Motivation and Context
Finally subscription has
idmanaged on remote-end (will be available in chrome/edge/ff v134). I means we don't need to manage a state on client side.Types of changes
Checklist
PR Type
Enhancement
Description
Introduced
SubscriptionID for managing event subscriptions.Updated
SubscribeandUnsubscribemethods to useSubscriptionID.Added new classes and converters for handling
Subscriptionserialization.Enhanced unsubscribe functionality with attribute-based and ID-based commands.
Changes walkthrough 📝
Broker.cs
Refactored subscription and unsubscription logicdotnet/src/webdriver/BiDi/Communication/Broker.cs
SubscribeAsyncto returnSubscriptionwith ID.UnsubscribeAsyncto useSubscriptionID.BiDiJsonSerializerContext.cs
Added serialization for new subscription commandsdotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs
SubscribeResult.SubscriptionConverter.cs
Added JSON converter for `Subscription`dotnet/src/webdriver/BiDi/Communication/Json/Converters/SubscriptionConverter.cs
SubscriptionConverterfor JSON serialization.Subscriptionobjects to/from JSON.SessionModule.cs
Enhanced session module with new subscription methodsdotnet/src/webdriver/BiDi/Modules/Session/SessionModule.cs
SubscribeAsyncto returnSubscribeResult.SubscribeCommand.cs
Introduced `SubscribeResult` for subscription responsesdotnet/src/webdriver/BiDi/Modules/Session/SubscribeCommand.cs
SubscribeResultto encapsulateSubscriptionID.Subscription.cs
Introduced `Subscription` class for event managementdotnet/src/webdriver/BiDi/Modules/Session/Subscription.cs
Subscriptionclass to encapsulate subscription ID.UnsubscribeCommand.cs
Added new commands for enhanced unsubscriptiondotnet/src/webdriver/BiDi/Modules/Session/UnsubscribeCommand.cs
UnsubscribeByIdCommandfor ID-based unsubscription.UnsubscribeByAttributesCommandfor attribute-basedunsubscription.
Subscription.cs
Enhanced `Subscription` class with ID-based logicdotnet/src/webdriver/BiDi/Subscription.cs
Subscriptionclass to includeSubscriptionID.UnsubscribeAsyncto use the new ID-based logic.