Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

wslink

kitware59.4kBSD-3-Clause2.3.4TypeScript support: included

Rpc and pub/sub between Python and JavaScript over WebSockets

readme

wslink

Wslink allows easy, bi-directional communication between a python server and a javascript client over a websocket. The client can make RPC calls to the server, and the server can publish messages to topics that the client can subscribe to. The server can include binary attachments in these messages, which are communicated as a binary websocket message, avoiding the overhead of encoding and decoding.

RPC and publish/subscribe

The initial users of wslink driving its development are VTK and ParaViewWeb. ParaViewWeb and vtkWeb require:

  • RPC - a remote procedure call that can be fired by the client and return sometime later with a response from the server, possibly an error.

  • Publish/subscribe - client can subscribe to a topic provided by the server, possibly with a filter on the parts of interest. When the topic has updated results, the server publishes them to the client, without further action on the client's part.

Get the whole story

This package is just the client side of wslink. See the github repo for the full story - and to contribute or report issues!

License

Free to use in open-source and commercial projects, under the BSD-3-Clause license.

changelog

2.3.4 (2025-05-20)

Bug Fixes

  • http-headers: override settings on reload only if env available (721eb54)

2.3.3 (2025-03-23)

Bug Fixes

  • HEART_BEAT: properly reload env when overriden (c5b7f3a)

2.3.2 (2025-02-21)

Bug Fixes

  • emitter: add EventEmitter tests and a way to specify allowed events (b079e2e)

2.3.1 (2025-02-21)

Bug Fixes

  • typing: remove typing messing up ParaView apps (158bbda)

2.3.0 (2025-02-20)

Features

  • protocol: log internal events through an object that can be subscribed to (89175ba)

2.2.2 (2025-01-07)

Bug Fixes

  • aiohttp: use AppKey for state (3a313f9)

2.2.1 (2024-09-16)

Bug Fixes

  • NetworkMonitor: add async completion() method (62e4c68)

2.2.0 (2024-09-16)

Features

  • NetworkMonitor: add support for network completion monitoring (3202aad)

2.1.3 (2024-09-09)

Bug Fixes

  • generic: proper api call (c443c74)

2.1.2 (2024-08-07)

Bug Fixes

  • js: sessionManagerURL use baseURI (bb4c34c)

2.1.1 (2024-06-20)

Bug Fixes

  • add missing future annotations for type hints (472950f)

2.1.0 (2024-06-19)

Features

  • http: add WSLINK_HTTP_HEADERS for HTTP header addon (7d16203)

2.0.5 (2024-06-06)

Bug Fixes

  • py: add msg overhead in size limit (5481a72)

2.0.4 (2024-05-24)

Bug Fixes

  • header: add default headers for shared_array_buffer (0f9f22c)

2.0.3 (2024-05-20)

Bug Fixes

  • unchunker: initial allowed message size to env var (#158) (488d637)

2.0.2 (2024-04-18)

Bug Fixes

  • jupyter: properly handle generic ws for jupyter (3bb84de)

2.0.1 (2024-04-16)

Bug Fixes

  • cli: remove shorthand args (880951a)

2.0.0 (2024-04-10)

Bug Fixes

  • python: make msgpack/chunking compatible down to python 3.7 (897ece7)

Features

  • chunking: implement chunking of client/server messages (a77a680)
  • msgpack: use msgpack to serialize/deserialize messages (4968ac1)

BREAKING CHANGES

  • chunking: each message has a header and is possibly chunked
  • msgpack: replace json serialization with msgpack

1.12.4 (2023-10-25)

Bug Fixes

1.12.3 (2023-10-05)

Bug Fixes

  • backend: properly handle async run state for generic (247b046)

1.12.2 (2023-09-27)

Bug Fixes

  • ci: semantic-release automation (5967efc)

1.12.0 (2023-09-27)

Features

  • jupyter: Add jupyter backend (db1bb39)

1.11.4 (2023-09-06)

Bug Fixes

  • protocol: const definition and usage (0c34a25)

1.11.3 (2023-09-05)

Bug Fixes

  • pub_manager: handle old global publish manager (d842b88), closes #146

1.11.2 (2023-08-30)

Bug Fixes

  • publish_manager: separation at server level for broadcast (ffd269d)

1.11.1 (2023-06-30)

Bug Fixes

  • aiohttp: use app var instead of inheritance (a0c7e64)
  • js: Allow JS to use custom WebSocket implementation (f7fad26)

1.11.0 (2023-06-09)

Features

  • backend: Add generic backend (d1b2b1b)
  • backend: Add tornado using the generic backend (ee15e86)
  • Rework code to simplify backends (114c422)

1.10.2 (2023-05-19)

Bug Fixes

  • SmartConnect: Allow delete to call exit later (eeb7637)

1.10.1 (2023-02-15)

Bug Fixes

  • gracefulexit: handle server exit for exec_mode=main (9e06313)
  • json5: Bump version (4d2e972)

1.10.0 (2022-12-20)

Features

  • launcher: Make GET/DELETE endpoint optionals (2dc2916)

1.9.3 (2022-12-19)

Bug Fixes

  • launcher: get/delete now works (c95a23d)

1.9.2 (2022-12-08)

Bug Fixes

  • sessionManagerURL: Make it path relative aware like default sessionURL (7c351a3)

1.9.1 (2022-11-01)

Bug Fixes

  • clientSession: Make reverse connection subscriptable (bb672ca)
  • subscriptable: fix typo (13b60c5)

1.9.0 (2022-10-20)

Features

  • skip_last_active_client: Better network handling for collaboration (e4844e6)

1.8.4 (2022-10-13)

Bug Fixes

  • ws_server: handle client disconnection even in case of error (0fa664e), closes #118

1.8.3 (2022-10-13)

Bug Fixes

  • security: publish messages only to authenticated clients (c630baa)

1.8.2 (2022-08-24)

Bug Fixes

  • ssl: forgot to import ssl from .ssl_context (d1f5f71)

1.8.1 (2022-08-24)

Bug Fixes

  • ssl: make import optional for ParaView (be11056)

1.8.0 (2022-08-24)

Features

  • SSL: support ssl context (00eed08)

1.7.0 (2022-08-11)

Features

  • reverse-connection: Add support for ClientWS and Relay service (f62fef3)

1.6.6 (2022-07-05)

Bug Fixes

  • aiohttp: Avoid newer, breaking versions (de16350)

1.6.5 (2022-06-03)

Bug Fixes

  • js: Properly handle protocol mapping (d02d41d)

1.6.4 (2022-05-05)

Bug Fixes

  • ws_server: Pass server at initialization (758afe3)

1.6.3 (2022-05-04)

Bug Fixes

  • startup-msg: Allow user to override startup message (eda7a11)

1.6.2 (2022-05-04)

Bug Fixes

  • ws: ensure valid ws before write (3ba4e60)

1.6.1 (2022-04-28)

Bug Fixes

  • auth,log: strip secret from logged messages (dec6080)

1.6.0 (2022-04-26)

Features

  • timeout: allow server without shutdown timeout (3200728)

1.5.3 (2022-04-14)

Bug Fixes

  • security: Allow to defer token validation to external method (06bec0d)

1.5.2 (2022-04-08)

Bug Fixes

  • py3.6: use get_event_loop instead of get_running_loop (1b2343c)

1.5.1 (2022-04-04)

Bug Fixes

  • license: include LICENSE file in wheel (615b8d6)

1.5.0 (2022-04-01)

Features

  • exec_mode: add exec_mode to start_webserver (011d387)

1.4.3 (2022-03-04)

Bug Fixes

  • queryString: Keep queryString for index.html redicrect (478ea09)

1.4.2 (2022-03-04)

Bug Fixes

  • relativePath: add support for relative sessionURL and index.html (4a53100)

1.4.1 (2022-02-09)

Bug Fixes

  • rpc: better handling awaitable rpc (e7eef8a)

1.4.0 (2022-02-08)

Features

  • heartbeat: Control heartbeat with WSLINK_HEART_BEAT env (2348bcb)

1.3.3 (2022-01-24)

Bug Fixes

  • ts: update the type definitions for subscribe (e300fda)

1.3.2 (2022-01-24)

Bug Fixes

  • js: Add more type annotations (5870064)

1.3.1 (2022-01-03)

Bug Fixes

  • python: use print for the startup message, not log.critical (bee2f52)

1.3.0 (2021-12-16)

Features

  • connection: forward request+client_id to life cycle methods (6c82264)

1.2.1 (2021-12-12)

Bug Fixes

  • aiohttp: register 30s heartbeat on ws (2f0cc9a)

1.2.0 (2021-12-06)

Features

  • port=0: Add infrastructure to handle dynamically assigned port (eca3e23)

1.1.1 (2021-11-19)

Bug Fixes

  • attachments: Better scheduleing for free (289f3df)

1.1.0 (2021-10-15)

Features

  • aiohttp: Control max wslink msg with env var (a30c5b2)

1.0.7 (2021-08-25)

Bug Fixes

  • cli: Revert default host arg to localhost (a39d8cf)
  • static: fix routes order definition for static content (60457ab)

1.0.6 (2021-08-20)

Bug Fixes

  • cli: Update default --host arg to 0.0.0.0 (ddbdda9)

1.0.5 (2021-08-13)

Bug Fixes

  • python: prevent raise condition when sending attachements (667e68e)

1.0.4 (2021-08-10)

Bug Fixes

  • JavaScript: SmartConnector default decorator (2973c8f)

1.0.3 (2021-08-10)

Bug Fixes

  • javascript: smartConnect will apply a default config decorator (11ce5a6)
  • publish: Only send publish msgs to each client once (65ab38d)

1.0.2 (2021-08-10)

Bug Fixes

  • http: Automatically server index.html (e43dde4)
  • scheduling: Support scheduling tasks before server starts (17c6750)

1.0.1 (2021-08-10)

Bug Fixes

  • js: Small code cleanup (58e025e)
  • Python: Better isolate backends implementations (457b181)

1.0.0 (2021-08-09)

Bug Fixes

  • dependencies: Move json5 from devDependencies to dependencies (bcb2919)
  • dependencies: update webpack for security updates. (27d6744)
  • deps: Replace twisted/autobahn with asyncio/aiohttp (2e804bb)
  • ProcessLauncher: Allow user to provide custom http headers (e831509)
  • publish: use manager to allow publish to all connected clients (83b94ab)
  • python: Automatic version handling (964db33)
  • python: Fix exit methods (a1627d0)
  • SmartConnect: Provide optional config decorator method (9b6302f)
  • twisted: Update to 19.2.1 which is the same as PV (b732f97)
  • version: Update version to 0.1.12 (71f8cce)
  • version: Update version to 0.1.13 (6cc5441)
  • websocket: allow publish before connect, as a no-op (10bef95)

BREAKING CHANGES

  • deps: remove Py2 support and switch to aiohttp server

Re-implement the back-end using the websocket server implementation from aiohttp, while leaving open the possibility of swapping out other backends down the road.