This commit is contained in:
crusader 2018-03-23 00:09:03 +09:00
parent 3e7ee505b4
commit 86a48a1e2b

View File

@ -193,6 +193,21 @@ func (s *fasthttpWebSocket) WriteMessage(messageType int, data []byte) error {
return s.Conn.WriteMessage(messageType, data) return s.Conn.WriteMessage(messageType, data)
} }
func (s *fasthttpWebSocket) WriteMessageUseWriter(messageType int, data []byte) error {
wc, err := s.NextWriter(messageType)
if nil != err {
return err
}
defer func() {
wc.Close()
}()
_, err = wc.Write(data)
return err
}
func (s *fasthttpWebSocket) Close() error { func (s *fasthttpWebSocket) Close() error {
err := s.Conn.Close() err := s.Conn.Close()
releaseSocket(s) releaseSocket(s)