What are the protocols to "Mos Tool"?

#1

Hello :slightly_smiling_face:

I am developing a test program simply sending “mos command” to “Mongoose OS” only using buttons.
But we faced the problem that it didn’t return data when sending a command.

So I’m writing to enquire about the program that is “mos tool”:
What is the communication protocol between “ESP32 on Mongoose OS” and “mos tool”?

ex) When we send mos command:
Typed command: “mos get init.js”
(EXAMPLE)Actual raw command sent (with communication protocol): “mos get init.js\r\n”

As a result, I want to know What are the protocols to “Mos Tool”.

#2

Mongoose-OS provides some services in the form or RPCs (Remote Procedure Calls). The example you post uses a filesystem service, there are others.
Those calls to perform remote procedures are carried, transported, over several possible protocols. In the example you post, unless you have set some environment variable, you seem to be using the serial port to connect.
The RPC body itself is (afaik) plain JSON.
The transport protocol can be HTTP, WebSockets, MQTT, (maybe) in your case some proprietary form over the serial port connected to the device UART, and perhaps other I don’t know about or just forgot to mention.
Did you read the docs ?

1 Like
#3

Thank you for replying.
I read your mention well.

But I need mos commands that for example “mos update”, “mos call ~~~”, “mos get” and no HTTP, WebSockets.
IIn this case, when I use UART, it must communicate by JSON?

Thank you For your helping.

Best Regards,
itsmyCareer

#4

mos update does not involve the device. Read the docs:

The mos tool could be self-updated via the Web UI or via the console command mos update

mos get

that filesystem service is implemented with an RPC

Explained here

There is a service implementation and its corresponding documentation. Read it here. And yes, it uses JSON.
As I said, the transport through UART is proprietary, I don’t know if it is documented, and I don’t guess why you need to know this having a tool that does all you might need. This means, if you see what is going through the UART you won’t see (just) JSON, there is a proprietary protocol transporting a JSON payload.

mos call calls an RPC. Each RPC has its corresponding documentation.
All available documentaion is here. The left column is your friend. API Reference -> RPC lists all the RPCs and services