﻿
# Touchpad server application
### Control a computer using a touch-screen phone or tablet

#### Description
This application allows the mouse cursor on a computer to be controlled by a
[web application](touchpad) over a WebSocket connection. Usually the
web application runs on a touch-screen phone or tablet. It is also possible
to utilise the server as part of remote control tools. 
Secure connections require a certificate file in the current directory with the
name `gvalkov.com.pem`.

#### Low latency control experience
The only factor affecting latency is the network medium. No noticeable
latency is observed over LAN cable: less than 1 *ms*, or Wi-Fi: around 4 *ms*.
With LTE however, the experience is affected by due to the higher latency:
around 40-80 *ms*.


#### Video demo [gTouchpad](https://youtu.be/-6GC3qK4poc)
[![gTouchpad](http://img.youtube.com/vi/-6GC3qK4poc/0.jpg)](https://youtu.be/-6GC3qK4poc)


#### Touchpad protocol

| Message              | Parameters        | Description |
| :------------------- | :---------------- | :---------- |
| down                 | *char*:`{LRMX}`   | Activate mouse button |
| down                 | L                 | Activate mouse button: Left |
| down                 | R                 | Activate mouse button: Right |
| down                 | M                 | Activate mouse button: Middle |
| down                 | X                 | Activate mouse button: Thumb (Back) |
| up                   | *char*:`{LRMX}`   | Deactivate mouse button |
| up                   | L                 | Deactivate mouse button: Left |
| up                   | R                 | Deactivate mouse button: Right |
| up                   | M                 | Deactivate mouse button: Middle |
| up                   | X                 | Deactivate mouse button: Thumb (Back) |
| touchstart           | *int*:X,*int*:Y   | Informational, does not do anything |
| touchend             |                   | Informational, does not do anything |
| touchcancel          |                   | Informational, does not do anything |
| touchmove            | *int*:dX,*int*:dY | Move the cursor |
| scroll               | *int*:dX,*int*:dY | Send a scroll event |
| zoom                 | *int*:dZ          | Send a zoom event |

#### Sample protocol
```powershell
touchstart 54,450   # touchstart at X=54, Y=450 (informational, ignored)
touchmove 0,-27     # touchmove dX=0, dY=-27
touchmove 0,-33
touchmove 1,-27
touchend            # touchend (informational, ignored)
touchstart 80,122
down L              # Activate mouse button: Left
touchend
up L                # Deactivate mouse button: Left
touchstart 223,121
down M, up M        # Click mouse button: Middle
touchstart 269,297
scroll -6,-40       # Send a scroll event dX=-6, dY=-40
scroll 0,-46
touchend
touchend
touchstart 262,67
touchstart 261,66
zoom -24            # Send a zoom event dZ=-24
zoom -26
zoom -23
```

#### Supported Platforms
☂︎ Apple iOS, macOS  
☂︎ FreeBSD  
☂︎ Linux  
☂︎ Windows  


#### [Prerequisites and build instructions](../../../lib.git#Prerequisites)


#### © 2015-2023 Georgi Valkov
https://httpstorm.com/download/g_touchpad/
