I'm not sure I fully understood you, but I'll give it a try anyway.
The following instructions will explain how to achieve something like this:|

radare2 comes with its own webserver. Although at first, it might seems like an overkill, its actually quite useful, especially when you want to debug embedded systems, or simply to execute commands from a remote terminal.
Simply launch the web server with =h <port> and connect to it with any HTTP client.
You can print the help for this command by using =h?:
[0x00000000]> =h?
|Usage: =[hH] [...] # http server
| http server:
| =h port listen for http connections (r2 -qc=H /bin/ls)
| =h- stop background webserver
| =h-- stop foreground webserver
| =h* restart current webserver
| =h& port start http server in background
| =H port launch browser and listen for http
| =H& port launch browser and listen for http in background
So let's use a oneliner command to spawn a radare2 web server with a session to our beloved /bin/ls/:
$ r2 -c=h /bin/ls
Starting http server...
open http://localhost:9090/
r2 -C http://localhost:9090/cmd/
Good, now that we have an HTTP server running with an open session, let's connect to it.
You can do this with curl:
$ curl http://127.0.0.1:9090/cmd/?EHello,World!
.--. .--------------.
| _| | |
| O O < Hello,World! |
| | | | |
|| | / `--------------'
|`-'|
`---'
You can even do this from your favorite browser:

Although it's cool, it isn't helping you -- you asked for a solution using r2pipe. Well... there is!
What is r2pipe?
The r2pipe APIs are based on a single r2 primitive found behind
r_core_cmd_str() which is a function that accepts a string parameter
describing the r2 command to run and returns a string with the result.
Source: r2pipe repository
As you probably know, using python, you can just do import r2pipe and r2pipe.open("/bin/ls") to open a radare2 session with "/bin/ls". Did you know that you can connect with r2pipe to a remote web server? Yup.
Let's write a quick script to do so:
import r2pipe
print("[+] Connecting with python r2pipe")
r2_remote = r2pipe.open("http://127.0.0.1:9090")
command = "?E Welcome from server!"
while command != "stop":
print (r2_remote.cmd(command))
command = raw_input("r2cmd > ")
Save the script to poc.py on you drive.
Now let's run r2 -c=h /bin/ls in one terminal and python poc.py in another one:

Yes, radare2 can also print QR codes.
e http.sandbox=false(so I can run scripts) and=h&and boom webservice in background and r2 still running normally! The setup I'm after may seem a little strange but everything works like I originally wanted. My python server runs and when a command is received it connects to the webservice and forwards any r2.cmd()'s to it! Thanks again for your help! – Nux May 23 '18 at 23:36