Skip to main content

A server for exposing Plover engine events and functionality

Project description

Plover WebSocket Server

Python Tests PyPI

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-websocket-server). 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.

  1. Open Plover
  2. Navigate to the Plugin Manager tool
  3. Select the "plover-websocket-server" plugin entry in the list
  4. Click install
  5. Restart Plover

The same method can be used for updating and uninstalling the plugin.

Configuration

A file named plover_websocket_server_config.json will be created inside Plover's configuration directory (same directory as plover.cfg file).

Example content:

{
    "private_key": "eb700b05b84a14b81ea69d5f826fc4ca30310db22f8943b1975fe56043c00771",
    "public_key": "3a283210963d849642011731ba048e8d8f2272802902a9ef7de56d0116236801",
    "host": "localhost",
    "port": 8086,
    "remotes": [
        {
            "pattern": "^https?\\:\\/\\/localhost?(:[0-9]*)?"
        }
    ],
    "ssl": {
        "cert_path": "/path/to/cert.pem",
        "key_path": "/path/to/key.pem"
    }
}

All fields are optional. But if you specify either a private or public key you need the opposed matching key also specified. The same pattern applies to the pair of ssl paths.

The default is included in the example above except for the private and public keys and the ssl paths which are just an example.

In the remotes config, either an object with a Regex pattern, or a string are supported. This is important to allow Cross Origin Resource Sharing (CORS) for the specific case where your client runs on a browser.

[!NOTE] This plugin utilises assymetric key encryption to protect the plugin from unauthorised access and is powered by Pynacl.

How to Use

  • Enable it in Configure -> Plugins
  • Connect to ws://localhost:8086/websocket 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_websocket_server/manager.py, or write an example program and observe its output.

[!TIP] Use the existing example script test/client_example.py to interact with the plugin.

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"}.

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.

[!WARNING] This should be used very sparingly because it may have unintended effects.

Acknowlegements

Forked from https://github.com/user202729/plover_websocket_server.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plover_websocket_server-0.1.8.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plover_websocket_server-0.1.8-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file plover_websocket_server-0.1.8.tar.gz.

File metadata

  • Download URL: plover_websocket_server-0.1.8.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for plover_websocket_server-0.1.8.tar.gz
Algorithm Hash digest
SHA256 aa5b441d6825288a34163c5ba83480265505a39ee077dcad61a42a7e28338ad7
MD5 735b227e48ef301f02c336f2e0343d5d
BLAKE2b-256 e9a61c25667ecc90766624b9c6636266daeb27767cb02307fd3a174d55c63aee

See more details on using hashes here.

File details

Details for the file plover_websocket_server-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for plover_websocket_server-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9bc072b619fc84bb6183b205fe90f9dd79306b204ff2fbd18027651e8bb03442
MD5 1003b653b6e91c5838712f7922e155d5
BLAKE2b-256 407c6e667ca2ed52212ca210f80da931043cd5312145e94bac4fa15368a56cbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page