@@ -101,7 +101,6 @@ public Uri ServerUri
101101 List < OnAnyHandler > _onAnyHandlers ;
102102 Dictionary < string , Action < SocketIOResponse > > _eventHandlers ;
103103 CancellationTokenSource _connectionTokenSorce ;
104- DateTime _pingTime ;
105104 double _reconnectionDelay ;
106105
107106
@@ -169,7 +168,8 @@ private void CreateRouterIfNull()
169168 Namespace = Namespace ,
170169 Path = Options . Path ,
171170 ServerUri = ServerUri ,
172- JsonSerializer = JsonSerializer
171+ JsonSerializer = JsonSerializer ,
172+ ConnectionTimeout = Options . ConnectionTimeout
173173 } ;
174174 if ( Options . Query != null )
175175 {
@@ -206,7 +206,7 @@ public async Task ConnectAsync()
206206 }
207207 catch ( Exception e )
208208 {
209- if ( e is TimeoutException || e is WebSocketException || e is HttpRequestException )
209+ if ( e is TimeoutException || e is WebSocketException || e is HttpRequestException || e is TimeoutException )
210210 {
211211 if ( ! Options . Reconnection )
212212 {
@@ -247,9 +247,10 @@ private async void PingHandler()
247247 {
248248 try
249249 {
250- _pingTime = DateTime . Now ;
250+ OnPing ? . Invoke ( this , EventArgs . Empty ) ;
251+ DateTime pingTime = DateTime . Now ;
251252 await Router . SendAsync ( new PongMessage ( ) , CancellationToken . None ) . ConfigureAwait ( false ) ;
252- OnPong ? . Invoke ( this , DateTime . Now - _pingTime ) ;
253+ OnPong ? . Invoke ( this , DateTime . Now - pingTime ) ;
253254 }
254255 catch ( Exception e )
255256 {
@@ -258,11 +259,6 @@ private async void PingHandler()
258259 }
259260 }
260261
261- private void PongHandler ( )
262- {
263- OnPong ? . Invoke ( this , DateTime . Now - _pingTime ) ;
264- }
265-
266262 private void ConnectedHandler ( ConnectedMessage msg )
267263 {
268264 Id = msg . Sid ;
@@ -380,7 +376,7 @@ private void OnMessageReceived(IMessage msg)
380376 PingHandler ( ) ;
381377 break ;
382378 case MessageType . Pong :
383- PongHandler ( ) ;
379+ // PongHandler();
384380 break ;
385381 case MessageType . Connected :
386382 ConnectedHandler ( msg as ConnectedMessage ) ;
0 commit comments