@@ -70,7 +70,7 @@ public class Client : INotifyPropertyChanged, IDisposable
7070 public event EventHandler < ErrorReceivedEventArgs > ? ErrorReceived ;
7171
7272 private readonly string teamsProcessName ;
73- private int requestId ;
73+ private int requestId = 1 ;
7474
7575 public Client ( bool autoConnect = false , string manufacturer = "Ro." , string device = "TeamsApiClient" , string app = "TeamsApiClient" , string appVersion = "1.0.0" , string ? token = null , CancellationToken cancellationToken = default )
7676 {
@@ -87,7 +87,6 @@ public Client(bool autoConnect = false, string manufacturer = "Ro.", string devi
8787 } else {
8888 teamsProcessName = "ms-teams" ;
8989 }
90- requestId = 1 ;
9190
9291 if ( autoConnect )
9392 _ = Connect ( true , cancellationToken ) ;
@@ -205,6 +204,7 @@ private async void Receive(CancellationToken cancellationToken = default)
205204 {
206205 clientInfo . Token = message . TokenRefresh ;
207206 TokenReceived ? . Invoke ( this , new TokenReceivedEventArgs ( message . TokenRefresh ) ) ;
207+ await SendCommand ( MeetingAction . QueryMeetingState , null , cancellationToken ) ;
208208 }
209209
210210 if ( message . MeetingUpdate is null || message . MeetingUpdate . MeetingState is null )
@@ -376,10 +376,10 @@ public async Task Connect(bool waitForTeams = true, CancellationToken cancellati
376376
377377 Connected ? . Invoke ( this , System . EventArgs . Empty ) ;
378378 Receive ( cancellationToken ) ;
379- if ( string . IsNullOrWhiteSpace ( clientInfo . Token ) ) {
379+ if ( string . IsNullOrWhiteSpace ( clientInfo . Token ) )
380380 await SendCommand ( MeetingAction . Pair , null , cancellationToken ) ;
381- }
382- await SendCommand ( MeetingAction . QueryMeetingState , null , cancellationToken ) ;
381+ else
382+ await SendCommand ( MeetingAction . QueryMeetingState , null , cancellationToken ) ;
383383 }
384384 finally
385385 {
0 commit comments