Klien abstraksi pangbasajanna jeung pangluhurna pikeun WebSocket dina JavaScript nyaéta WebSocket API, anu kaasup dina kalolobaan panyungsi wéb modéren. Éta nyayogikeun API tingkat handap pikeun nyiptakeun sambungan WebSocket sareng ngirim sareng nampi pesen. Ieu mangrupikeun conto kumaha nyiptakeun sambungan WebSocket dina JavaScript: `` javascript socket = anyar WebSocket: 'ws://localhost:8080'); socket.addEventListener'open', () {console.log'WebSocket sambungan diadegkeun'); }; socket.addEventListener'message', => {console.log'Received message:', event.data); }); socket.addListener'close', {socket.Socket.(Socket:Socket's closing event.}; kode konci. }; closed.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence