A server for exposing Plover engine events and functionality
Project description
Plover WebSocket Server
A WebSocket server for exposing Plover events and controlling Plover from an external program.
This plugin is available on GitHub
and PyPI (under the name plover-engine-server-2
).
Report all bugs on GitHub.
Installation
Download the latest version of Plover for your operating system from the releases page. Only versions 4.0.0.dev8 and higher are supported.
- Open Plover
- Navigate to the Plugin Manager tool
- Select the "plover-engine-server-2" plugin entry in the list
- Click install
- Restart Plover
The same method can be used for updating and uninstalling the plugin.
Configuration
To configure the plugin, create a file named plover_engine_server_config.json
inside Plover's configuration directory (same directory as plover.cfg
file).
Example content:
{
"host": "localhost",
"port": 8086,
"secretkey": "mysecretkey",
"ssl": {
"cert_path": "/path/to/cert.pem",
"key_path": "/path/to/key.pem"
}
}
All fields are optional, except if you have either specified a cert_path
or a key_path
. In that case you have to make sure that the path pair is properly set there. The default is included in the example above.
How to Use
- Enable it in Configure -> Plugins
- Connect to either ws://localhost:8086/websocket or wss://localhost:8086/websocket, depending on whether or not you have specified SSL configuration, with your client and get the data pushed to you as event: data formatted JSON.
Received data format
Search for occurrences of queue_message
in plover_engine_server/manager.py
,
or write an example program (or use the existing plover_engine_server/websocket/example_client.py
)
and observe its output.
Controlling Plover from other programs:
- Sending 'close' disconnects you.
- Sending a valid JSON string will execute the specified action.
For example
{"stroke": ["S-"]}
(note that invalid keys are silently dropped), or{"translation": "abc"}
.
Note: to avoid Plover being controlled by a malicious website, you should set some other than default key, and
add the secret key to the request header X-Secret-Token
.
If there's some error during the execution, it will be silently ignored and printed on stderr.
If the "force"
key is true
then the command will be executed even when the engine is turned off.
Note that {PLOVER:RESUME}
will have no effect in that case.
Because the Plover inner working is closely tied to the assumption
that strokes can only come from the keyboard, when {PLOVER:RESUME}
(or a command with similar effect,
such as {PLOVER:TOGGLE}
) is sent and the machine is
"Keyboard" then some characters before the cursor will be deleted.
To prevent this, set the "zero_last_stroke_length"
key to true
.
Note This should be used very sparingly because it may have unintended effects.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plover_engine_server_2-0.1.2.tar.gz
.
File metadata
- Download URL: plover_engine_server_2-0.1.2.tar.gz
- Upload date:
- Size: 31.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c033c045d084d0be84dcefe4929866a359b2b9fc74e9977e6ad1e0f40edb095 |
|
MD5 | 7f50d91d6999f4f6cbfbf50d8acbd3c0 |
|
BLAKE2b-256 | d34ebed507de581e0ce74bdf73a7c49b71665269c5d089ae587ac18834cdd281 |
File details
Details for the file plover_engine_server_2-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: plover_engine_server_2-0.1.2-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02ca1aa6d0bc343c0bbffae6e01fac48521a188e145623549a59fa9972508404 |
|
MD5 | 1f99850e14a22b5de14d382df9919ba8 |
|
BLAKE2b-256 | 6b6c5876cd5190fa48a5fcf9c4a8cf1893610a97d53df5fb0ab97fc36fadd9fd |