DEV Community

Cover image for The Power of Pure HTTP – screen share, real-time messaging, SSH and VNC

The Power of Pure HTTP – screen share, real-time messaging, SSH and VNC

Ryo Ota on December 17, 2020

Hi all. Today, I'd like to show you the power of pure HTTP stream, which allows us to do screen sharing, video chatting, real-time text messaging, ...
Collapse
 
codr profile image
Ilya Nevolin

Wonderful, I love all of this!

Remote control for a Windows machine would a great addition though, not sure how realistic that would be to implement, guess I'll have to use Teamviewer/AnyDeks for now.

Another thing that spikes my interest is SSH in the browser, but I'm using key pairs instead of user:pass method, is that possible with this?

Collapse
 
cubiclesocial profile image
cubiclesocial

For SSH in the browser, yes, it is possible to use SSH keys. I support both methods in File Tracker:

file-tracker.cubiclesoft.com/

It uses a combination of (WebSocket-based):

github.com/cubiclesoft/php-app-ser...

And the beta async support from:

github.com/cubiclesoft/php-ssh

To provide two-way, async communication with a SSH host.

Collapse
 
pratikdhaboo profile image
Pratik Dhaboo

May be we can use robot.js alongside the screen share to transmit mouse and keyboard events.

Collapse
 
marataziat profile image
marataziat

Very cool! Websockets sucks because you need to do 2 things to sync the user: rest api request to get the initial data, and websocket connection to receive events. So you need to do 2 things to keep the user in sync. You can not push initial data via websocket when user connects because of websocket data framing.

This is also a good replacement for SSE.

I also hope http 3 support will be there soon, so there will be more stuff to explore for real time apps.

Collapse
 
sm0ke profile image
Sm0ke

Unconventional niceeee ...

Collapse
 
khuongduybui profile image
Duy K. Bui

I can see a lot of potentials in this approach. Thanks for the detailed post and ready-to-use sample resources.

I have a few questions:

  • What would be the strategy to handle disconnect / reconnect to guarantee no loss of data?
  • From what I understand, we can easily support multi-poster and multi-getter against the same "stream" without complications. Is that correct? Are there any pitfalls I have not recognized?
Collapse
 
mickeyklai profile image
mickeyklai

Wow!
Very good and informative article!
Thank you🙏

One question that popped into my mind during reading this is wether it's possible to transport tcp over Piping server, similary to ssh over http scenario?

Collapse
 
cubiclesocial profile image
cubiclesocial

This is fairly reminiscent of my PHP Cool File Transfer project where I did something similar a few years ago:

github.com/cubiclesoft/php-cool-fi...

One client basically creates a mini-TCP server inside a PHP script on the server and another client somewhere else connects to the mini-TCP server and receives the file as a direct transfer. PHP emits a byte every second to keep the connection alive for the person who is sending the file until the second client connects and accepts or rejects the file. If the file is accepted, then it starts transferring. The web server doesn't store any data - it just sends the data to the other side. The setup of a temporary TCP/IP server per file is somewhat exotic.

There is a slight gotcha with the approach: A GET method caller never finishes as can be seen in the "Simple text messaging" example for Piping Server where the loading indicator never stops spinning. That means onload won't fire in that case. In the instance of a file download, the download manager takes over and handles the request. The solution is to wait until the page has finished loading and then make a XHR request.

Collapse
 
mikaelgramont profile image
Mikael Gramont

What a cool project.
That's the nice thing about tools that the leverage existing web ecosystem, the results can be really impressive while at the same time everyone is like "wait, yeah, of course, that should have been obvious".

Collapse
 
amissine profile image
Alec Missine

Great work, Ryo! Thanks for sharing!

Collapse
 
jianwu profile image
jianwu • Edited

Nice work and great blog. Is it possible to implement peer to peer streaming, so the data traffic won't pass through server.

Collapse
 
awsonly1 profile image
awsonly

Nice work and interesting. Lot of depth in the article !!

Collapse
 
m4r4v profile image
m4r4v

Absolutely outstanding!!

Great article, very well written, useful and approachable.

Thanks you!!

Collapse
 
shaikh profile image
Javed Shaikh

Awesome 👏🏼. I am going to give it a try.

Collapse
 
king11 profile image
Lakshya Singh

I am in awe of this project 😐 completely mind bogling

Collapse
 
mandarvaze profile image
Mandar Vaze

This is truly an awesome project

Collapse
 
parkerproject profile image
Parker

Great article, I'm literally going to keep 1 hour aside to go through this in-depth

Collapse
 
funkeeflow profile image
Florian Berg

This is great! Any observations on latency compared to websockets?

Collapse
 
boobewc profile image
wanchai chaisalee

"Voice and video chatting" Example not working, anyone help ?

Collapse
 
edward93 profile image
Edward Chopuryan

What kind of sorcery is this and why I haven't heard of this before?! (lol) I'm blown away! Good work, this is amazing! 😊

Collapse
 
cneilmon profile image
Raymond Neil Cerezo

nice! i learned a lot today 😊 thanks!