snooowfire / ironhive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to give remote command to the agent?

mocusez opened this issue · comments

Could you please write a example about how to give remote command to the agent?
It's ok you have test, but it seems to be better to give a full instruction book and details with different arguments
image

The entire agent consists of only one RPC service used to handle NATS messages. If you want to perform remote control, you can only do so by sending NATS requests to the NATS server. For specific requests, you can refer to the following location: crates/shared/src/request.rs.

To understand how to make requests, you can refer to the test case below:

client
    .publish_with_reply(agent_id.to_string(), "your_reply".into(), IronhiveRequest::Ping.as_bytes())
    .await
    .unwrap();

This code snippet demonstrates an example of making a request. The client.publish_with_reply function is used to publish a NATS message with a reply subject and payload. In this case, the request being sent is IronhiveRequest::Ping.

Additionally, I have updated the installation instructions in the README. I hope you can take a look at it.

Something is confused:
Is that agent ID generate by agent, or NATS server?
I remember that publish_with_reply need to give a certain channel name

————Updated:
Ok, I get AgentID from nats-top
I believe this must be mention on document

JavaScript Running is OK.
This issue will be close.
985d58932c228649f878d60c0b35ab3