fix Send(): FINAL + TYPE were hard-coded

This commit is contained in:
xdrm-brackets 2018-05-06 00:27:45 +02:00
parent 7fa43b2c00
commit 98ce1dddbe
1 changed files with 5 additions and 1 deletions

View File

@ -166,7 +166,11 @@ func (m Message) Send(writer io.Writer) error {
}
/* (1) Byte 0 : FIN + opcode */
header = append(header, 0x80 | byte(TEXT) )
var final byte = 0x80
if !m.Final {
final = 0
}
header = append(header, final | byte(m.Type) )
/* (2) Get payload length */
if m.Size < 126 { // simple