Add (*Conn).WriteText(message string)

This commit is contained in:
GeertJohan 2014-02-25 22:22:40 +01:00
parent 119002ce04
commit 592945ff2f
1 changed files with 6 additions and 0 deletions

View File

@ -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