@@ -14,7 +14,10 @@ public class WebSocketSession : AppSession, IHandshakeRequiredSession
1414
1515 public HttpHeader HttpHeader { get ; internal set ; }
1616
17- public string Path => HttpHeader . Path ;
17+ public string Path
18+ {
19+ get { return HttpHeader . Path ; }
20+ }
1821
1922 public string SubProtocol { get ; internal set ; }
2023
@@ -36,41 +39,46 @@ public virtual ValueTask SendAsync(WebSocketPackage message, CancellationToken c
3639 public virtual ValueTask SendAsync ( string message , CancellationToken cancellationToken = default )
3740 {
3841 return SendAsync ( new WebSocketPackage
39- {
40- OpCode = OpCode . Text ,
41- Message = message
42- } ,
43- cancellationToken ) ;
42+ {
43+ OpCode = OpCode . Text ,
44+ Message = message
45+ } ,
46+ cancellationToken ) ;
4447 }
4548
4649 public override ValueTask SendAsync ( ReadOnlyMemory < byte > data , CancellationToken cancellationToken = default )
4750 {
4851 return SendAsync ( new WebSocketPackage
49- {
50- OpCode = OpCode . Binary ,
51- Data = new ReadOnlySequence < byte > ( data )
52- } ,
53- cancellationToken ) ;
52+ {
53+ OpCode = OpCode . Binary ,
54+ Data = new ReadOnlySequence < byte > ( data )
55+ } ,
56+ cancellationToken ) ;
57+ }
58+
59+ public override ValueTask SendAsync ( byte [ ] data , CancellationToken cancellationToken = default )
60+ {
61+ return SendAsync ( new ReadOnlySequence < byte > ( data ) , cancellationToken ) ;
5462 }
5563
5664 public virtual ValueTask SendAsync ( ReadOnlySequence < byte > data , CancellationToken cancellationToken = default )
5765 {
5866 return SendAsync ( new WebSocketPackage
59- {
60- OpCode = OpCode . Binary ,
61- Data = data
62- } ,
63- cancellationToken ) ;
67+ {
68+ OpCode = OpCode . Binary ,
69+ Data = data
70+ } ,
71+ cancellationToken ) ;
6472 }
6573
6674 public ValueTask CloseAsync ( CloseReason reason , string reasonText = null , CancellationToken cancellationToken = default )
6775 {
6876 var closeReasonCode = ( short ) reason ;
6977
7078 var closeStatus = new CloseStatus
71- {
72- Reason = reason
73- } ;
79+ {
80+ Reason = reason
81+ } ;
7482
7583 var textEncodedLen = 0 ;
7684
@@ -97,11 +105,11 @@ public ValueTask CloseAsync(CloseReason reason, string reasonText = null, Cancel
97105 OnCloseHandshakeStarted ( ) ;
98106
99107 return SendAsync ( new WebSocketPackage
100- {
101- OpCode = OpCode . Close ,
102- Data = new ReadOnlySequence < byte > ( buffer , 0 , length )
103- } ,
104- cancellationToken ) ;
108+ {
109+ OpCode = OpCode . Close ,
110+ Data = new ReadOnlySequence < byte > ( buffer , 0 , length )
111+ } ,
112+ cancellationToken ) ;
105113 }
106114
107115 private void OnCloseHandshakeStarted ( )
0 commit comments