Commit 2f80a39a authored by Vincent Wei's avatar Vincent Wei
Browse files

change the protocols

parent 75aa7713
# MiniGUI Remote Server
# Web Display Server
Web Display Server is a general WebSocket server which can acts as a broker of
a local display (GUI) client and a WebSocket client (webpage).
By using the Web Display Server, you can run a GUI (MiniGUI) app in your
webpage!
## Story
1. A webpage connects the Server via the URI:
ws://<domain.nam>:7777/<display-client-name>?width=<horizontal-resolution-in-pixel>&height=<vertical-resolution-in-pixel>
2. A local display client specified by the URI will be forked and executed
by the Server.
3. The local dipslay client then connencts to the Server via UnixSocket:
* The Server will create a shadow frame buffer for the client according to
the resolution specified by the URI. The pixel format of the shadow FB
will be always RGB888.
* The local display client sends the dirty rectangle and raw pixels of the
display to the Server via the UnixSocket (/var/tmp/web-display-server).
* The server converts the pixels to RGB888 format and stores to the shadow
frame buffer.
* The Server sends the input events received from the web client to the
display client via the UnixSocket.
4. The Server encodes the pixels in the accumulated dirty rectangle
in PNG format and sends the data to the web client in every 35ms.
The data will be a WebSocket binary packet and contain:
* The dirty rectangle of the display.
* The pixels of the dirty rectangle encoded in PNG format.
5. The web client can send the keyboard and touch events to the Server.
So the user can interact with the display client.
## Protocols
### WebSocket
### UnixSocekt
MiniGUI Remote Server acts as a Websocket server and a UNIX domain socket server at
the same time.
......@@ -20,19 +66,19 @@ the same time.
3. The server also creates a UNIX domain socket at a well-known path (/var/tmp/mg-remote-sever)
and wait for the connection from the MiniGUI client.
4. The MiniGUI client connects to the UNIX socket, creates a shared memory as a
4. The MiniGUI client connects to the UnixSocket, creates a shared memory as a
virtual frame buffer, and sends the identifier of the shared memory to the server
via the UNIX socket.
via the UnixSocket.
5. Note that the resolution of the virtual frame buffer should be sent by the server as
the first message.
6. The server accepts the connection request from the MiniGUI client, gets the
identifier of the shared memory sent by the client via the UNIX socket,
identifier of the shared memory sent by the client via the UnixSocket,
and attaches to the shared memory.
7. The MiniGUI client sends the dirty rectangle information via the
UNIX socket, and the server then sends the information and the pixel data
UnixSocket, and the server then sends the information and the pixel data
to the WebSocket client. For the performance reason, the server creates
a shadow frame buffer and copy the pixel data from the virtual frame buffer
and send an ACK message to MiniGUI client immediately when it gets the dirty
......@@ -40,13 +86,13 @@ the same time.
frame buffer to the WebSocket client.
8. The server gets the input events from the WebSocket client and sends them
to the MiniGUI client via the UNIX socket.
to the MiniGUI client via the UnixSocket.
Note that this server is based on the work of allinurl at:
## Other information
Note that this Server is based on the work of allinurl at:
https://github.com/allinurl/gwsocket
The sofware `gwsocket` is licensed under MIT.
## Usage
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment