ReadonlyCLOSEDReadonlyCLOSINGReadonlyCONNECTINGReadonlyextensionsReadonlynameThe stream name this connection was opened against.
ReadonlyOPENReadonlyprotocolAlways empty: subprotocols and extensions are not negotiated.
ReadonlyurlStatic ReadonlyCLOSEDStatic ReadonlyCLOSINGStatic ReadonlyCONNECTINGStatic ReadonlyOPENBytes queued by send() that have not yet reached Go.
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsClose the connection. Go's handler sees Receive fail and returns.
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Optionaloptions: boolean | EventListenerOptionsSend a frame to Go. Accepts anything a WebSocket does; strings are encoded as UTF-8, since Go receives every frame as a byte slice.
A stream connection. Implements the useful subset of the
WebSocketinterface, so the same application code works against a real WebSocket in server builds.One deliberate divergence from the standard:
binaryTypedefaults to"arraybuffer"rather than"blob", because stream frames are always binary and a Blob would force an extra async hop to read every message. Setting it to"blob"behaves as the standard describes.