ObjectQL
ReferenceAPI Reference

WebSocket API

WebSocket API

(Planned Feature)

For real-time updates and live data synchronization.

Connection

const ws = new WebSocket('ws://localhost:3000/api/realtime');
 
ws.onopen = () => {
  // Authenticate
  ws.send(JSON.stringify({
    type: 'auth',
    token: 'your_jwt_token'
  }));
  
  // Subscribe to changes
  ws.send(JSON.stringify({
    type: 'subscribe',
    object: 'orders',
    filters: [["status", "=", "pending"]]
  }));
};
 
ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  
  if (data.type === 'change') {
    console.log('Record changed:', data.record);
  }
};

On this page