From 592945ff2f2b27b0ef2ad10a1fd930f3f3d5f247 Mon Sep 17 00:00:00 2001 From: GeertJohan Date: Tue, 25 Feb 2014 22:22:40 +0100 Subject: [PATCH] Add (*Conn).WriteText(message string) --- conn.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conn.go b/conn.go index 050d8bc..c2a6d43 100644 --- a/conn.go +++ b/conn.go @@ -493,6 +493,12 @@ func (c *Conn) WriteMessage(messageType int, data []byte) error { return nil } +// WriteText writes given string with messageType TextMessage +// Is actually a shorthand for (*Conn).WriteMessage(websocket.TextMessage, []byte(message)) +func (c *Conn) WriteText(message string) error { + return c.WriteMessage(TextMessage, []byte(message)) +} + // SetWriteDeadline sets the deadline for future calls to NextWriter and the // io.WriteCloser returned from NextWriter. If the deadline is reached, the // call will fail with a timeout instead of blocking. A zero value for t means