// WriteText is a shorthand for
// c.WriteMessage(websocket.TextMessage, []byte(s)).
164439
func (c *Websocket) WriteText(s string) *Websocket {
	if c.checkUnusable("WriteText") {
		return c
	}
	return c.WriteMessage(websocket.TextMessage, []byte(s))
}
135456
func (c *connection) Write(websocketMessageType int, data []byte) error {
	// for any-case the app tries to write from different goroutines,
	// we must protect them because they're reporting that as bug...
	c.writerMu.Lock()
	if writeTimeout := c.server.config.WriteTimeout; writeTimeout > 0 {
		// set the write deadline based on the configuration
		c.underline.SetWriteDeadline(time.Now().Add(writeTimeout))
	}

	// .WriteMessage same as NextWriter and close (flush)
	err := c.underline.WriteMessage(websocketMessageType, data)
	c.writerMu.Unlock()
	if err != nil {
		// if failed then the connection is off, fire the disconnect
		c.Disconnect()
	}
	return err
}
47750
func (c *Conn) WriteMessage(messageType int, data []byte) error {

	if c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) {
		// Fast path with no allocations and single frame.

		var mw messageWriter
		if err := c.beginMessage(&mw, messageType); err != nil {
			return err
		}
		n := copy(c.writeBuf[mw.pos:], data)
		mw.pos += n
		data = data[n:]
		return mw.flushFrame(true, data)
	}

	w, err := c.NextWriter(messageType)
	if err != nil {
		return err
	}
	if _, err = w.Write(data); err != nil {
		return err
	}
	return w.Close()
}
886230
func (c *Conn) SendText(text string) (err error) {
	return c._send(TextMessage, []byte(text))
}
177547
func (s *Socket) SendText(data string) (err error) {
	return s.Conn.WriteMessage(websocket.TextMessage, []byte(data))
}
344093
func (c *Client) SendText(data string) (err error) {
	return c.Conn.WriteMessage(websocket.TextMessage, []byte(data))
}
953128
func (msg Message) WriteTo(w io.Writer) (int64, error) {
	var bytesWritten int

	nw, err := fmt.Fprintf(w, "%s%s", msg.Address, msg.Typetags())
	if err != nil {
		return 0, err
	}
	bytesWritten += nw

	for _, a := range msg.Arguments {
		nw, err := a.WriteTo(w)
		if err != nil {
			return 0, err
		}
		bytesWritten += int(nw)
	}

	return int64(bytesWritten), nil
}
400664
func errorText(err error) string {
	var buf bytes.Buffer
	bw := bufio.NewWriter(&buf)
	writeErrorText(bw, err)
	bw.Flush()
	return buf.String()
}
1059187
func Text(expected, actual interface{}) *Result {
	exp, expErr := toText(expected)
	act, err := toText(actual)
	if err != nil {
		return &Result{err: fmt.Sprintf("[diff] actual: %s", err)}
	}
	var d *Result
	if expErr != nil {
		d = &Result{err: fmt.Sprintf("[diff] expected: %s", expErr)}
	} else {
		exp = strings.TrimSuffix(exp, "\n")
		act = strings.TrimSuffix(act, "\n")
		d = TextSlices(
			strings.SplitAfter(exp, "\n"),
			strings.SplitAfter(act, "\n"),
		)
	}
	return update(UpdateMode, expected, act, d)
}
436472
func (a *DispatchKeyEventArgs) SetText(text string) *DispatchKeyEventArgs {
	a.Text = &text
	return a
}
852188
func (c *wsConn) Write(b []byte) (int, error) {
	err := c.conn.WriteMessage(websocket.BinaryMessage, b)
	if err != nil {
		return 0, err
	}

	return len(b), nil
}
586247
func (ctxt *Context) Write(p []byte) (n int, err error) {
	if ctxt.direct {
		return ctxt.w.Write(p)
	}
	return ctxt.buf.Write(p)
}
1177412
func (c *Callbacks) OnCUserMessageSayText(fn func(*dota.CUserMessageSayText) error) {
	c.onCUserMessageSayText = append(c.onCUserMessageSayText, fn)
}
251075
func (w *Socket) write(mt int, payload []byte) error {
	w.writeMutex.Lock()
	defer w.writeMutex.Unlock()

	w.ws.SetWriteDeadline(time.Now().Add(writeWait))
	return w.ws.WriteMessage(mt, payload)
}
78178
func (txt *Text) WriteString(s string) (n int, err error) {
	txt.buf = append(txt.buf, s...)
	txt.drawBuf()
	return len(s), nil
}
1069055
func (w *DecodedJSONMessageWriter) Write(b []byte) (int, error) {
	err := jsonmessage.DisplayJSONMessagesStream(bytes.NewReader(b), w.w, w.fd, false, nil)
	if err != nil {
		if err, ok := err.(*jsonmessage.JSONError); ok {
			w.err = err
			return len(b), nil
		}
	}
	return len(b), err
}
308638
func (r *Response) Text(text string) error {
	return r.Raw([]byte(text))
}