debug: Add WebSocket message validation debugging

**Motivations :**
- Debug why handshake messages are being filtered by validator
- Understand WebSocket message structure and validation errors

**Modifications :**
- Added detailed logging for raw WebSocket messages
- Added validation result logging
- Enhanced error reporting for invalid messages

**Pages affectées :**
- src/websockets.ts - Enhanced WebSocket debugging
This commit is contained in:
NicolasCantu 2025-10-23 19:18:44 +02:00
parent c21de2b943
commit 08a47fab3e
2 changed files with 7 additions and 1 deletions

View File

@ -2116,7 +2116,7 @@ export default class Services {
spAddressType: typeof handshakeMsg.sp_address,
spAddressLength: handshakeMsg.sp_address?.length
});
if (handshakeMsg.sp_address) {
this.updateRelay(url, handshakeMsg.sp_address);
this.relayAddresses[url] = handshakeMsg.sp_address;

View File

@ -28,9 +28,15 @@ export async function initWebsocket(url: string) {
if (typeof msgData === 'string') {
try {
// Valider le message avant traitement
console.log('🔍 DEBUG: Raw WebSocket message:', msgData);
const validation = messageValidator.validateWebSocketMessage(msgData);
console.log('🔍 DEBUG: Validation result:', validation);
if (!validation.isValid) {
console.warn('⚠️ Invalid WebSocket message received:', {
errors: validation.errors,
messagePreview: msgData.substring(0, 100)
});
secureLogger.warn('Invalid WebSocket message received', {
component: 'WebSocket',
operation: 'message_validation',