Files
Baradb/docs/tr/api-websocket.md

78 lines
980 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# WebSocket API
Gerçek zamanlı veri akışları ve anlık bildirimler için tam çift yönlü akış.
## Bağlantı
```
ws://localhost:9471/ws
```
## İstemci Örneği
```javascript
const ws = new WebSocket('ws://localhost:9471/ws');
ws.onopen = () => {
ws.send(JSON.stringify({
type: 'query',
sql: 'SELECT * FROM users'
}));
};
ws.onmessage = (event) => {
console.log('Received:', JSON.parse(event.data));
};
```
## Mesaj Formatı
```json
{
"type": "query",
"id": "uuid",
"sql": "SELECT * FROM users"
}
```
## Mesaj Türleri
### Sorgu İsteği
```json
{
"type": "query",
"id": "123",
"sql": "SELECT * FROM users"
}
```
### Sorgu Yanıtı
```json
{
"type": "result",
"id": "123",
"data": [{"id": 1, "name": "Alice"}]
}
```
### Abonelik
```json
{
"type": "subscribe",
"table": "users"
}
```
### Anlık Bildirim
```json
{
"type": "push",
"table": "users",
"action": "insert",
"data": {"id": 3, "name": "Charlie"}
}
```