JavaScript-da WebSocket uchun eng oddiy va eng yuqori abstraktsiyali mijoz - bu WebSocket API, u ko'pgina zamonaviy veb-brauzerlarga kiritilgan. U WebSocket ulanishlarini yaratish va xabarlarni yuborish va qabul qilish uchun past darajadagi API-ni taqdim etadi. Bu erda JavaScript-da WebSocket ulanishini qanday yaratish mumkinligi haqida misol keltirilgan: ``` javascript const socket = new WebSocket (('ws://localhost:8080'); socket.addEventListener (('open' () => { console.log'WebSocket ulanish o'rnatildi'); }); socket.addEventListener (('message', event => { console.log.('Received message:', event.data }); socket.addEventListener (('close event
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence