possible to send command directly to WebREPL

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
skimj
Posts: 3
Joined: Thu Mar 09, 2017 5:25 am

possible to send command directly to WebREPL

Postby skimj » Thu Mar 09, 2017 5:13 pm

Is there any trivial way to programmatically send a single command directly to WebREPL?

For a simple, brute example, imagine that you need to reset the device. Your options are: 1) physically press reset button or 2) start a browser with the WebREPL client, press connect, login, and finally type:`machine.reset()` at the terminal prompt. It would be really cool if it were possible to do something like: `webrepl_cli.cmd('machine.reset()')`

Following the webrepl_cli.py code, I'm able to create a connection, login and get the remote WebREPL version. webrepl_cli.send_req() uses a coded 'op' of 1, 2, or 3 to simplify the communication. Possibly, I could add an option 4 and hard-code the desired command in the micropython device. (I can't find the receiving end of this WebREPL code)

Obviously, the WebREPL http client ternimal is capable of sending individual characters, same as if they were typed at a REPL prompt, which tells me there would at least be a way to send raw socket data to accomplish the same goal? I don't have a clue how to even approach this method.

Any other ideas?

Return to “General Discussion and Questions”

Who is online

Users browsing this forum: No registered users and 3 guests