@@ -130,6 +130,10 @@ jobs:
130130 # Test WebSocket connection with proper authentication parameters
131131 curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==" "http://127.0.0.1:54321/realtime/v1/websocket?apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0&vsn=1.0.0" || echo "WS connection failed"
132132
133+ echo "Testing direct WebSocket connection to realtime service (bypassing Kong)"
134+ # Test direct connection to realtime service on port 4000
135+ curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==" "http://127.0.0.1:4000/socket/websocket?apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0&vsn=1.0.0" || echo "Direct WS connection failed"
136+
133137 echo "Testing realtime endpoint directly"
134138 curl -v http://127.0.0.1:54321/realtime/v1/ || echo "Realtime endpoint failed"
135139
@@ -142,6 +146,47 @@ jobs:
142146 echo "Testing realtime subscription endpoint"
143147 curl -v -X POST -H "Content-Type: application/json" -H "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" -d '{"channel":"test-channel","type":"broadcast"}' http://127.0.0.1:54321/realtime/v1/api/broadcast || echo "Realtime broadcast failed"
144148
149+ echo "Testing direct realtime service endpoints"
150+ curl -v http://127.0.0.1:4000/api/ping || echo "Direct realtime ping failed"
151+ curl -v -H "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" http://127.0.0.1:4000/api/ping || echo "Direct realtime ping with auth failed"
152+
153+ echo "Testing WebSocket connection with Node.js"
154+ npm install ws || echo "Failed to install ws package"
155+ node -e "
156+ const WebSocket = require('ws');
157+ const ws = new WebSocket('ws://127.0.0.1:54321/realtime/v1/websocket?apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0&vsn=1.0.0');
158+
159+ ws.on('open', () => {
160+ console.log('WebSocket connection opened');
161+ // Send a phx_join message
162+ const joinMessage = JSON.stringify({
163+ topic: 'realtime:test-channel',
164+ event: 'phx_join',
165+ payload: { config: { broadcast: { self: false }, presence: { key: '' }, private: false } },
166+ ref: '1'
167+ });
168+ console.log('Sending join message:', joinMessage);
169+ ws.send(joinMessage);
170+ });
171+
172+ ws.on('message', (data) => {
173+ console.log('Received message:', data.toString());
174+ });
175+
176+ ws.on('error', (error) => {
177+ console.log('WebSocket error:', error.message);
178+ });
179+
180+ ws.on('close', (code, reason) => {
181+ console.log('WebSocket closed:', code, reason.toString());
182+ });
183+
184+ setTimeout(() => {
185+ console.log('Closing WebSocket connection');
186+ ws.close();
187+ }, 5000);
188+ " || echo "Node.js WebSocket test failed"
189+
145190 docker ps --format '{{.Names}}'
146191
147192 echo "docker logs"
0 commit comments