wsaccel: WebSocket Accelerator

0.6.7 · deprecated · verified Thu Apr 16

wsaccel is a Python library that provides a WebSocket accelerator for `ws4py` and `AutobahnPython`. It replaces per-byte processing in these libraries with a faster Cython implementation, primarily for UTF-8 validation and payload masking. The project is currently at version 0.6.7, but its maintainer has indicated that it will cease active development due to its dependencies (ws4py and AutobahnPython) no longer being actively maintained. Users are advised to migrate to more actively supported WebSocket libraries like Tornado or websockets.

Common errors

Warnings

Install

Imports

Quickstart

After installing `wsaccel`, it typically needs to be explicitly patched into `AutobahnPython` or `ws4py` to provide acceleration. For `websocket-client`, `wsaccel` is automatically used if present. The patching calls should be made before the target library processes WebSocket frames.

import wsaccel

# To accelerate AutobahnPython:
# import autobahn.websocket
# wsaccel.patch_autobahn()
# print('AutobahnPython patched by wsaccel.')

# To accelerate ws4py:
# import ws4py.server.cherrypyserver
# wsaccel.patch_ws4py()
# print('ws4py patched by wsaccel.')

print('wsaccel imported. Manual patching for target libraries is required if not automatically detected.')

view raw JSON →