mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-09 23:34:51 +01:00
| .. | ||
| src | ||
| Makefile | ||
| README | ||
WebSocket API for QuickJS
===============
Introduction
------------
This is an implementation of the W3C WebSocket API for the QuickJS
JavaScript engine on top of the libwebsockets C library.
Usage
------------
import { WebSocket } from '/usr/lib/quickjs/websocket.js'
const w = new WebSocket('wss://example.com/', ['protocol1', 'protocol2'])
globalThis.WebSocket = WebSocket // To make the API available globally
Limitations
------------
Events emitted by WebSocket objects do not implement the full DOM
event specification. Only a subset of properties is available. The
EventTarget interface, i.e. addEventListener/removeEventListener, is
unimplemented. The onopen/onerror/onclose/onmesseage handlers have to
be used instead.