Send a message of message_type
        :param connection_id: the identity for the connection to send to
        :param message_type: validator_pb2.Message.* enum value
        :param data: bytes serialized protobuf
        :return: future.Future
359419
def send(self, message_type, data, connection_id, callback=None,
             one_way=False):
        
        if connection_id not in self._connections:
            raise ValueError("Unknown connection id: {}".format(connection_id))
        connection_info = self._connections.get(connection_id)
        if connection_info.connection_type == \
                ConnectionType.ZMQ_IDENTITY:
            message = validator_pb2.Message(
                correlation_id=_generate_id(),
                content=data,
                message_type=message_type)

            timer_tag = get_enum_name(message.message_type)
            timer_ctx = self._get_send_response_timer(timer_tag).time()
            fut = future.Future(
                message.correlation_id,
                message.content,
                callback,
                timeout=self._connection_timeout,
                timer_ctx=timer_ctx)
            if not one_way:
                self._futures.put(fut)

            self._send_receive_thread.send_message(msg=message,
                                                   connection_id=connection_id)
            return fut

        return connection_info.connection.send(
            message_type,
            data,
            callback=callback,
            one_way=one_way)
1031798
def post_message(plugin, polled_time, identity, message):
    
    user = plugin.build_identifier(identity)
    return plugin.send(user, message)
1089011
function (id, type, action, data) {
		var messageObject = {
			id: id,
			type: type,
			action: action,
			data: data
		};
		sendMessage(messageObject);
	}
573966
private void sendMessage(BeanMessageID type, Message message) {
        Buffer buffer = new Buffer();
        buffer.writeByte((type.getRawValue() >> 8) & 0xff);
        buffer.writeByte(type.getRawValue() & 0xff);
        buffer.write(message.toPayload());
        GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray());
        gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer());
    }
1026713
def receive_message(self, operation, request_id):
        
        try:
            return receive_message(
                self.sock, operation, request_id, self.max_message_size)
        except BaseException as error:
            self._raise_connection_failure(error)
629342
def sendMessage(self, message, thread_id=None, thread_type=ThreadType.USER):
        
        return self.send(
            Message(text=message), thread_id=thread_id, thread_type=thread_type
        )
407430
def send_document(self, chat_id, data, reply_to_message_id=None, caption=None, reply_markup=None,
                      parse_mode=None, disable_notification=None, timeout=None):
        
        return types.Message.de_json(
            apihelper.send_data(self.token, chat_id, data, 'document', reply_to_message_id, reply_markup,
                                parse_mode, disable_notification, timeout, caption=caption))
854513
function Message(name, reqType, errType, resType, oneWay, doc) {
  this.name = name;
  if (!Type.isType(reqType, 'record')) {
    throw new Error('invalid request type');
  }
  this.requestType = reqType;
  if (
    !Type.isType(errType, 'union') ||
    !Type.isType(errType.getTypes()[0], 'string')
  ) {
    throw new Error('invalid error type');
  }
  this.errorType = errType;
  if (oneWay) {
    if (!Type.isType(resType, 'null') || errType.getTypes().length > 1) {
      throw new Error('inapplicable one-way parameter');
    }
  }
  this.responseType = resType;
  this.oneWay = !!oneWay;
  this.doc = doc !== undefined ? '' + doc : undefined;
  Object.freeze(this);
}
279496
def reply(self, message: typing.Union[int, types.Message]):
        
        setattr(self, 'reply_to_message_id', message.message_id if isinstance(message, types.Message) else message)
        return self
36999
def _ipc_send(self, sock, message_type, payload):
        '''
        
        '''
        sock.sendall(self._pack(message_type, payload))
        data, msg_type = self._ipc_recv(sock)
        return data
989859
def publish(self, message_type=ON_SEND, client_id=None, client_storage=None,
                *args, **kwargs):
        
        self.publisher.publish(
            message_type, client_id, client_storage, *args, **kwargs)
1222318
def send_message(self, destination_id, namespace, data,
                     inc_session_id=False, callback_function=False,
                     no_add_request_id=False, force=False):
        

        # namespace is a string containing namespace
        # data is a dict that will be converted to json
        # wait_for_response only works if we have a request id

        # If channel is not open yet, connect to it.
        self._ensure_channel_connected(destination_id)

        request_id = None
        if not no_add_request_id:
            request_id = self._gen_request_id()
            data[REQUEST_ID] = request_id

        if inc_session_id:
            data[SESSION_ID] = self.session_id

        # pylint: disable=no-member
        msg = cast_channel_pb2.CastMessage()

        msg.protocol_version = msg.CASTV2_1_0
        msg.source_id = self.source_id
        msg.destination_id = destination_id
        msg.payload_type = cast_channel_pb2.CastMessage.STRING
        msg.namespace = namespace
        msg.payload_utf8 = _json_to_payload(data)

        # prepend message with Big-Endian 4 byte payload size
        be_size = pack(">I", msg.ByteSize())

        # Log all messages except heartbeat
        if msg.namespace != NS_HEARTBEAT:
            self.logger.debug("[%s:%s] Sending: %s",
                              self.fn or self.host, self.port,
                              _message_to_string(msg, data))

        if not force and self.stop.is_set():
            raise PyChromecastStopped("Socket client's thread is stopped.")
        if not self.connecting and not self._force_recon:
            try:
                if not no_add_request_id and callback_function:
                    self._request_callbacks[request_id] = {
                        'event': threading.Event(),
                        'response': None,
                        'function': callback_function,
                    }
                self.socket.sendall(be_size + msg.SerializeToString())
            except socket.error:
                self._request_callbacks.pop(request_id, None)
                self._force_recon = True
                self.logger.info('[%s:%s] Error writing to socket.',
                                 self.fn or self.host, self.port)
        else:
            raise NotConnected("Chromecast " + self.host + ":" +
                               str(self.port) + " is connecting...")
661822
def set_connection_type(self, connection_type):
        
        result = self.library.Cli_SetConnectionType(self.pointer,
                                                    c_uint16(connection_type))
        if result != 0:
            raise Snap7Exception("The parameter was invalid")
1086823
def send(self, peer_id, message):
        
        assert isinstance(message, beans.RawMessage)

        # Get peer description (raises KeyError)
        peer = self._directory.get_peer(peer_id)

        # Get a link to the peer (raises ValueError)
        link = self._get_link(peer)
        assert isinstance(link, beans.AbstractLink)

        # Call the link, and return its result
        return link.send(message)
1151490
async def open_interface(self, conn_id, interface):
        

        self._ensure_connection(conn_id, True)
        connection_string = self._get_property(conn_id, "connection_string")

        msg = dict(interface=interface, connection_string=connection_string)
        await self._send_command(OPERATIONS.OPEN_INTERFACE, msg, COMMANDS.OpenInterfaceResponse)
904758
def _send(self, msg):
        
        uuid = self.m2req.sender
        conn_id = self.m2req.conn_id

        header = "%s %d:%s," % (uuid, len(str(conn_id)), str(conn_id))
        zmq_message = header + ' ' + msg
        self.stream.send(zmq_message)
857149
def update_message_type(self, message_type):
        
        self._validate_uuid(message_type.message_type_id)

        url = "/notification/v1/message-type/{}".format(
            message_type.message_type_id)
        response = NWS_DAO().putURL(
            url, self._write_headers(), self._json_body(
                message_type.json_data()))

        if response.status != 204:
            raise DataFailureException(url, response.status, response.data)
        return response.status