From 98ce1dddbee48ac93a064e4ff73adfaecfd3564c Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 6 May 2018 00:27:45 +0200 Subject: [PATCH] fix Send(): FINAL + TYPE were hard-coded --- ws/message.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ws/message.go b/ws/message.go index 3060d5a..006644b 100644 --- a/ws/message.go +++ b/ws/message.go @@ -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