Chess Web Engine Protocol 1.0

Chess engines,
meet the web.

An open JSON protocol for connecting chess applications to engine adapters through a JavaScript bridge.

CWEP messagePLUGIN TO HOST
{
  "protocol": "cwep",
  "version": "1.0",
  "type": "analysisUpdate",
  "requestId": "search-1",
  "payload": {
    "depth": 18,
    "score": {
      "kind": "cp", "value": 28,
      "pov": "sideToMove"
    },
    "pv": ["e2e4", "c7c5"]
  }
}
An illustrative analysis update from the engine adapter.

From host application to engine

The host loads a plugin page over HTTPS, discovers its capabilities and uses the JavaScript bridge for analysis. The Stockfish example runs in WebAssembly so a browser or WebView can analyze a position on the device.

Host application

Sends a FEN position and search limits.

CWEP adapter

Validates requests and returns analysis updates.

Chess engine

Searches the position using its own engine interface.

Protocol comparison

CWEP and UCI

Both carry positions, search limits, evaluations and principal variations. The Stockfish example uses CWEP at the web boundary and UCI inside the adapter.

AspectCWEP 1.0UCI
FormatJSON messages with typed payloadsText commands and responses
TransportJavaScript bridge in a WebView, with same-document events for browsersTypically a process’s standard input and output
Common useWeb and embedded WebView integrationsDesktop chess GUIs and engine tools

Open source

An independent project.

CWEP is a privately maintained open-source initiative. The specification is MIT-licensed, and any engine can implement it. Chessory is a separate chess application that uses CWEP.

Browse example implementations