System Online

WebSocket API

Gerçek zamanlı olayları dinlemek ve entegre etmek için kapsamlı dokümantasyon ve araçlar.

Host
zone.test
Port
8086
Key
1
Channel
dialog-socket

Entegrasyon

Tarayıcı tabanlı uygulamalar için WebSocket bağlantı örneği.

const ws = new WebSocket('ws://zone.test:8086/app/1');

ws.onopen = () => {
    ws.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: 'dialog-socket' } }));
};

ws.onmessage = (e) => {
    const msg = JSON.parse(e.data);
    if (msg.event?.startsWith('pusher:')) return;
    
    const data = msg.data ? JSON.parse(msg.data) : {};
    
    switch(msg.event) {
        case 'exit.plate.detection':
            console.log('Çıkış:', data.plate, data.price + ' TL');
            break;
        case 'hgs.payment.success':
        case 'pos.payment.success':
            console.log('Ödeme OK - Bariyer aç');
            break;
        case 'hgs.payment.failed':
        case 'pos.payment.failed':
            console.log('Ödeme HATA');
            break;
    }
};

Olay Türleri

Canlı Test

Bağlı değil
0
Toplam Olay
-
Son Olay
Olaylar bekleniyor...