Send a frame over the websocket with message as its payload
330649
def send(self, message, binary=False):
        
        if binary is None:
            binary = not isinstance(message, six.string_types)
        opcode = self.OPCODE_BINARY if binary else self.OPCODE_TEXT
        try:
            self.send_frame(message, opcode)
        except WebSocketError:
            raise WebSocketError("Socket is dead")
299648
def send(self, message):
        """"""
        if isinstance(message, bytes):
            message = message.decode("utf8")

        with self.send_lock:
            try:
                self.ws.send(message)
            except socket.error:
                chat_backend.unsubscribe(self)
1046112
def send_message(self, msg, stats=True, binary=False):
        
        self.send_jsonified(proto.json_encode(bytes_to_str(msg)), stats)
632860
def send_frame(xml)
        xml = xml.to_s if xml.kind_of?(Request)
        @sock.write([xml.size + HEADER_LEN].pack("N") + xml)
      end
1035156
def received_message(self, m):
        """"""

        # TODO: No support for binary messages
        m = str(m)
        logger.debug("Incoming upstream WS: %s", m)
        uwsgi.websocket_send(m)
        logger.debug("Send ok")
517574
public void sendAsync(BasicMessageWithExtraData<? extends BasicMessage> messageWithData) {
        if (!isConnected()) {
            throw new IllegalStateException("WebSocket connection was closed. Cannot send any messages");
        }

        BasicMessage message = messageWithData.getBasicMessage();
        configurationAuthentication(message);

        sendExecutor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    if (messageWithData.getBinaryData() == null) {
                        String messageString = ApiDeserializer.toHawkularFormat(message);
                        @SuppressWarnings("resource")
                        Buffer buffer = new Buffer().writeUtf8(messageString);
                        RequestBody requestBody = RequestBody.create(WebSocket.TEXT, buffer.readByteArray());
                        FeedCommProcessor.this.webSocket.sendMessage(requestBody);
                    } else {
                        BinaryData messageData = ApiDeserializer.toHawkularFormat(message,
                                messageWithData.getBinaryData());

                        RequestBody requestBody = new RequestBody() {
                            @Override
                            public MediaType contentType() {
                                return WebSocket.BINARY;
                            }

                            @Override
                            public void writeTo(BufferedSink bufferedSink) throws IOException {
                                emitToSink(messageData, bufferedSink);
                            }
                        };

                        FeedCommProcessor.this.webSocket.sendMessage(requestBody);
                    }
                } catch (Throwable t) {
                    log.errorFailedToSendOverFeedComm(message.getClass().getName(), t);
                }
            }
        });
    }
299725
def send_frame(self, frame):
        

        self._sendbuf += self._send_streamify(frame)
        self._sendbuf_event.set()
1036139
def do_async_send(self):
        
        assert len(self.sendbuf)

        nwritten = self.sock.send(self.sendbuf)
        nframes = 0

        for entry in self.sendbuf_frames:
            frame, offset, callback = entry

            if offset <= nwritten:
                nframes += 1

                if callback:
                    callback()
            else:
                entry[1] -= nwritten

        self.sendbuf = self.sendbuf[nwritten:]
        self.sendbuf_frames = self.sendbuf_frames[nframes:]
830151
def frame_msg(body, header=None, raw_body=False):  # pylint: disable=unused-argument
    '''
    
    '''
    framed_msg = {}
    if header is None:
        header = {}

    framed_msg['head'] = header
    framed_msg['body'] = body
    return salt.utils.msgpack.dumps(framed_msg)
278535
def write_frame(self, buf):
        '''
        
        '''
        writer = Writer(buf)

        writer.write_octet(self.type()).\
            write_short(self.channel_id).\
            write_long(len(self._payload)).\
            write(self._payload).\
            write_octet(0xce)
700025
def send(self, payload):
        
        payload = self.encode(payload)
        payload = self.sign(payload)
        self.socket.send(payload)
1285361
def frame(*msgs):
    """"""
    res = io.BytesIO()
    for msg in msgs:
        res.write(msg)
    msg = res.getvalue()
    return pack('L', len(msg)) + msg
587642
private void sendHeartbeat(WebSocket websocket) {
        ObjectNode heartbeatPacket = JsonNodeFactory.instance.objectNode();
        heartbeatPacket.put("op", GatewayOpcode.HEARTBEAT.getCode());
        heartbeatPacket.put("d", lastSeq);
        WebSocketFrame heartbeatFrame = WebSocketFrame.createTextFrame(heartbeatPacket.toString());
        nextHeartbeatFrame.set(heartbeatFrame);
        websocket.sendFrame(heartbeatFrame);
    }
1335963
async def send(self, payload='', action_type='', channel=None, **kwds):
        
        # use a custom channel if one was provided
        channel = channel or self.producer_channel

        # serialize the action type for the
        message = serialize_action(action_type=action_type, payload=payload, **kwds)
        # send the message
        return await self._producer.send(channel, message.encode())
419340
def send_message(type, message=nil)
      message = message.nil? ? message = '' : message.to_json
      body = type + ' ' + message
      body.strip!
      length = body.bytesize
      @client.write("#{length}\n#{body}")
    end
682190
async def pong(self, message: bytes=b'') -> None:
        """"""
        if isinstance(message, str):
            message = message.encode('utf-8')
        await self._send_frame(message, WSMsgType.PONG)
606912
function WebSocketFrame(maskBytes, frameHeader, config) {
    this.maskBytes = maskBytes;
    this.frameHeader = frameHeader;
    this.config = config;
    this.maxReceivedFrameSize = config.maxReceivedFrameSize;
    this.protocolError = false;
    this.frameTooLarge = false;
    this.invalidCloseFrameLength = false;
    this.parseState = DECODE_HEADER;
    this.closeStatus = -1;
}