简体   繁体   中英

AngularJS: how to get system remote?

Please let me elaborate what is my goal

How to take a remote desktop connection from my Angular.js application of a windows application running system. My server is Google App Engine.

What I have thought of so far:

  1. Windows application will take screen shots and send to Google App Engine Channel API.
  2. The Google App Engine channel API will notify the Angular app and send it the screen shots and show it.

The problem with this method is that it's very costly and slow.

Request

Please suggest some tool or api or a way to make a screen sharing application.

This will not be the answer you are looking for but read on either way.

tl;dr;

What you are trying to do is not an App Engine use case and you really shouldn't use App Engine to implement this kind of solution.

long version:

  • As you found out yourself the channel API will become costly and slow for what you are trying to do. This is because the channel API simply isn't made to stream large amounts of data to the client. It's meant to send regular updates to client, like incoming updates for a real time chat or news ticker. Best case scenario is that you only notify the client of new content and the client requests this new content from the server. So you could send the URL of the new screenshot to the client and the client requests it. When you stream a desktop or a video this is very unnecessary though because what you want with that kind of streaming is as many updates as you can get. You might as well just poll every few milliseconds.
  • Using screenshots to share a desktop is a particular kind of madness because the data "stream" cannot be compressed properly and will thus be way larger than it has to be. Usually remote desktop systems use compression very similar to video compression algorithms where only the changes / difference of the previous picture / frame will be transmitted and there's a full key frame once in a while. More data means more bandwidth and more latency in your stream. It's really important that you at least try to minimize the dataflow as much as possible.
  • The goal in most App Engine applications is to allow scaling to thousands of parallel connections. This is accomplished by allowing multiple instances to serve the same content and by enforcing several restriction (like 60 seconds request deadline for frontend / 10 minutes for backend request, maximum bandwidth usuage in a single request, etc.) which chop huge tasks into small requests which can then be served by the multitude of app engine instances. The same restrictions will not allow you to create a long running continuous data stream for something like video or remote desktop streaming. If you poll every few milliseconds as suggested above, app engine would spawn new instances on a regular basis which would cause warm up requests and further delays.

But enough of what won't work, this is an example of what should work:

  • Streaming server are actually servers which allow direct streaming to clients
  • Streaming servers publish their service URL to your app engine application
  • Your AngularJS application requests a stream from the app engine application
  • App Engine tells the AngularJS application the streaming server information from above
  • The client requests the stream directly from the server

This approach leaves out app engine as a proxy for your data - so you don't have to worry about the streaming data. It does however require your server to be directly available on the internet.

Alternatively, there are a vast number of applications / services (twitch.tv to name an example) available which allow desktop streaming without you writing a single line of code. Such streams could simply be embedded in your Angular application. Since this is not Software Recommendations i don't want to go any deeper into this matter here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM