@@ -49,8 +49,18 @@ public class WssClient : HttpsClient, IWebSocket
49
49
50
50
public override bool Connect ( ) { _syncConnect = true ; return base . Connect ( ) ; }
51
51
public override bool ConnectAsync ( ) { _syncConnect = false ; return base . ConnectAsync ( ) ; }
52
- public virtual bool Close ( int status ) { SendClose ( status , Span < byte > . Empty ) ; base . Disconnect ( ) ; return true ; }
53
- public virtual bool CloseAsync ( int status ) { SendCloseAsync ( status , Span < byte > . Empty ) ; base . DisconnectAsync ( ) ; return true ; }
52
+ public virtual bool Close ( int status ) => Close ( status , Span < byte > . Empty ) ;
53
+ public virtual bool Close ( int status , string text ) => Close ( status , Encoding . UTF8 . GetBytes ( text ) ) ;
54
+ public virtual bool Close ( int status , ReadOnlySpan < char > text ) => Close ( status , Encoding . UTF8 . GetBytes ( text . ToArray ( ) ) ) ;
55
+ public virtual bool Close ( int status , byte [ ] buffer ) => Close ( status , buffer . AsSpan ( ) ) ;
56
+ public virtual bool Close ( int status , byte [ ] buffer , long offset , long size ) => Close ( status , buffer . AsSpan ( ( int ) offset , ( int ) size ) ) ;
57
+ public virtual bool Close ( int status , ReadOnlySpan < byte > buffer ) { SendClose ( status , buffer ) ; base . Disconnect ( ) ; return true ; }
58
+ public virtual bool CloseAsync ( int status ) => CloseAsync ( status , Span < byte > . Empty ) ;
59
+ public virtual bool CloseAsync ( int status , string text ) => CloseAsync ( status , Encoding . UTF8 . GetBytes ( text ) ) ;
60
+ public virtual bool CloseAsync ( int status , ReadOnlySpan < char > text ) => CloseAsync ( status , Encoding . UTF8 . GetBytes ( text . ToArray ( ) ) ) ;
61
+ public virtual bool CloseAsync ( int status , byte [ ] buffer ) => CloseAsync ( status , buffer . AsSpan ( ) ) ;
62
+ public virtual bool CloseAsync ( int status , byte [ ] buffer , long offset , long size ) => CloseAsync ( status , buffer . AsSpan ( ( int ) offset , ( int ) size ) ) ;
63
+ public virtual bool CloseAsync ( int status , ReadOnlySpan < byte > buffer ) { SendClose ( status , buffer ) ; base . DisconnectAsync ( ) ; return true ; }
54
64
55
65
#endregion
56
66
0 commit comments