@@ -96,7 +96,7 @@ public Uri ServerUri
9696
9797 public Func < IClientWebSocket > ClientWebSocketProvider { get ; set ; }
9898
99- public List < Type > ExpectedExceptions { get ; private set ; }
99+ List < Type > _expectedExceptions ;
100100
101101 int _packetId ;
102102 Dictionary < int , Action < SocketIOResponse > > _ackHandlers ;
@@ -153,7 +153,7 @@ private void Initialize()
153153 _connectionTokenSorce = new CancellationTokenSource ( ) ;
154154 HttpClient = new HttpClient ( ) ;
155155 ClientWebSocketProvider = ( ) => new DefaultClientWebSocket ( ) ;
156- ExpectedExceptions = new List < Type >
156+ _expectedExceptions = new List < Type >
157157 {
158158 typeof ( TimeoutException ) ,
159159 typeof ( WebSocketException ) ,
@@ -215,7 +215,7 @@ public async Task ConnectAsync()
215215 }
216216 catch ( Exception e )
217217 {
218- if ( ExpectedExceptions . Contains ( e . GetType ( ) ) )
218+ if ( _expectedExceptions . Contains ( e . GetType ( ) ) )
219219 {
220220 if ( ! Options . Reconnection )
221221 {
@@ -661,6 +661,14 @@ private async void InvokeDisconnect(string reason)
661661 }
662662 }
663663
664+ public void AddExpectedException ( Type type )
665+ {
666+ if ( ! _expectedExceptions . Contains ( type ) )
667+ {
668+ _expectedExceptions . Add ( type ) ;
669+ }
670+ }
671+
664672 public void Dispose ( )
665673 {
666674 HttpClient . Dispose ( ) ;
0 commit comments