Files
yachtpit/test_bounding_box.js
Geoff Seemueller a4337cae3c AIS (Automatic identification system) Integration: Maritime (#12)
* WIP: Enable dynamic AIS stream handling based on user location and map focus.

- Prevent AIS stream from starting immediately; start upon user interaction.
- Add `ais_stream_started` state for WebSocket management.
- Extend `useRealAISProvider` with `userLocationLoaded` and `mapFocused` to control stream.
- Update frontend components to handle geolocation and map focus.
- Exclude test files from compilation

Introduce WebSocket integration for AIS services

- Added WebSocket-based `useRealAISProvider` React hook for real-time AIS vessel data.
- Created various tests including unit, integration, and browser tests to validate WebSocket functionality.
- Added `ws` dependency to enable WebSocket communication.
- Implemented vessel data mapping and bounding box handling for dynamic updates.

* **Introduce Neumorphic UI design with new themes and styles**
- Added NeumorphicTheme implementation for light and dark modes.
- Refactored `LayerSelector` and `MapNext` components to use the neumorphic style and color utilities.
- Updated `menu.rs` with neumorphic-inspired button and background styling.
- Enhanced GPS feed and vessel popups with neumorphic visuals, improving clarity and aesthetics.
- Temporarily disabled base-map dependency in `yachtpit` for isolation testing.

* update names in layer selector

* Update search button text to "Search..." for better clarity.

* Add key event handlers for search and result selection in App.tsx

* Implement AIS Test Map application with WebSocket-based vessel tracking and Mapbox integration.

* Refactor AIS server to use Axum framework with shared stream manager and state handling. Fix metadata key mismatch in frontend vessel mapper.

* Remove AIS provider integration and related vessel markers

* Remove `ais-test-map` application, including dependencies, configuration, and source files.

* ais data feed functional, bb query is overshot, performance degraded

* Add AIS module as a build dependency

---------

Co-authored-by: geoffsee <>
2025-07-21 21:12:29 -04:00

67 lines
2.0 KiB
JavaScript

#!/usr/bin/env node
// Test WebSocket bounding box functionality
const WebSocket = require('ws');
const ws = new WebSocket('ws://localhost:3000/ws');
ws.on('open', function open() {
console.log('Connected to AIS WebSocket server');
// Send bounding box configuration message
const boundingBoxMessage = {
type: 'set_bounding_box',
bounding_box: {
sw_lat: 33.7,
sw_lon: -118.3,
ne_lat: 33.8,
ne_lon: -118.2
}
};
console.log('Sending bounding box configuration:', boundingBoxMessage);
ws.send(JSON.stringify(boundingBoxMessage));
});
ws.on('message', function message(data) {
const message = data.toString();
if (message.startsWith('Connected to AIS stream')) {
console.log('✓ Received connection confirmation:', message);
} else {
try {
const parsedData = JSON.parse(message);
if (parsedData.type === 'bounding_box_set') {
console.log('✓ Received bounding box confirmation:', parsedData);
} else if (parsedData.mmsi || parsedData.ship_name) {
console.log('✓ Received filtered AIS data:', {
mmsi: parsedData.mmsi,
ship_name: parsedData.ship_name,
latitude: parsedData.latitude,
longitude: parsedData.longitude,
timestamp: parsedData.timestamp
});
} else {
console.log('✓ Received message:', parsedData);
}
} catch (e) {
console.log('✓ Received text message:', message);
}
}
});
ws.on('error', function error(err) {
console.error('WebSocket error:', err);
});
ws.on('close', function close() {
console.log('WebSocket connection closed');
});
// Keep the script running for 15 seconds to receive some filtered data
setTimeout(() => {
console.log('Closing connection after 15 seconds...');
ws.close();
process.exit(0);
}, 15000);