mirror of https://github.com/jkjoy/sunpeiwen.git
854 B
854 B
Class: WebSocket
⚠️ Warning: the WebSocket API is experimental and has known bugs.
Extends: EventTarget
The WebSocket object provides a way to manage a WebSocket connection to a server, allowing bidirectional communication. The API follows the WebSocket spec.
new WebSocket(url[, protocol])
Arguments:
- url
URL | string
- The url's protocol must bews
orwss
. - protocol
string | string[]
(optional) - Subprotocol(s) to request the server use.