You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: websocket.go
+34-15Lines changed: 34 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,7 @@ type control struct {
23
23
typeConnstruct {
24
24
subprotocolstring
25
25
br*bufio.Reader
26
-
// TODO switch to []byte for write buffering because for messages larger than buffers, there will always be 3 writes. One for the frame, one for the message, one for the fin.
27
-
// Also will help for compression.
26
+
// TODO switch to []byte for write buffering for predicting compression in memory maybe
28
27
bw*bufio.Writer
29
28
closer io.Closer
30
29
clientbool
@@ -36,7 +35,7 @@ type Conn struct {
36
35
// Writers should send on write to begin sending
37
36
// a message and then follow that up with some data
38
37
// on writeBytes.
39
-
writechanDataType
38
+
writechanMessageType
40
39
controlchancontrol
41
40
writeByteschan []byte
42
41
writeDonechanstruct{}
@@ -45,9 +44,10 @@ type Conn struct {
45
44
// Then send a byte slice to readBytes to read into it.
46
45
// The n of bytes read will be sent on readDone once the read into a slice is complete.
// TODO this is potentially racey as if we return if the context is cancelled, or the conn is closed we don't know if the p is ok to use. we must close the connection and also ensure the readLoop is done before returning, likewise with writes.
0 commit comments