chore: full stack stability and migration fixes, plus react UI progress
This commit is contained in:
24
tests/integration/test_direct_ws.js
Normal file
24
tests/integration/test_direct_ws.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import WebSocket from 'ws';
|
||||
const headers = { 'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhbm9uIiwicm9sZSI6ImFub24iLCJpc3MiOiJtYWRiYXNlIiwiaWF0IjoxNzczNjk0OTEwLCJleHAiOjE3NzQyOTk3MTB9.kiDrLssL7YrvQdiOvhbH6qsvcO_O2cc4v6i5s2zN3wM' };
|
||||
const ws = new WebSocket('ws://localhost:8002/realtime/v1/websocket', { headers });
|
||||
ws.on('open', () => {
|
||||
console.log('WebSocket connected');
|
||||
ws.send(JSON.stringify(['1', '1', 'realtime:public:todos', 'phx_join', { config: { access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhbm9uIiwicm9sZSI6ImFub24iLCJpc3MiOiJtYWRiYXNlIiwiaWF0IjoxNzczNjk0OTEwLCJleHAiOjE3NzQyOTk3MTB9.kiDrLssL7YrvQdiOvhbH6qsvcO_O2cc4v6i5s2zN3wM', postgres_changes: [{ schema: 'public', table: 'todos' }] } }]));
|
||||
});
|
||||
ws.on('message', (data) => {
|
||||
console.log('Received message:', data.toString());
|
||||
});
|
||||
ws.on('error', (error) => {
|
||||
console.error('WebSocket error:', error);
|
||||
});
|
||||
ws.on('close', (code, reason) => {
|
||||
console.log('WebSocket closed:', code, reason.toString());
|
||||
});
|
||||
setTimeout(() => {
|
||||
if (ws.readyState === WebSocket.OPEN) {
|
||||
ws.close();
|
||||
} else {
|
||||
console.error('WebSocket did not connect within 5 seconds');
|
||||
process.exit(1);
|
||||
}
|
||||
}, 5000);
|
||||
Reference in New Issue
Block a user