From 86a48a1e2b51c4b54beb4686040c254cb7314029 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 23 Mar 2018 00:09:03 +0900 Subject: [PATCH] ing --- socket.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/socket.go b/socket.go index 965b4b8..7dae5ae 100644 --- a/socket.go +++ b/socket.go @@ -193,6 +193,21 @@ func (s *fasthttpWebSocket) WriteMessage(messageType int, data []byte) error { 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 { err := s.Conn.Close() releaseSocket(s)