Files
wl-webrtc/.sisyphus/notepads/wl-webrtc-implementation/issues.md
2026-02-03 11:14:25 +08:00

2.4 KiB

Task 7: WebSocket Signaling Server - Issues Encountered

Build System Issues

  • libspa-sys build script failed when running full cargo test due to missing PipeWire dev dependencies
  • Solution: Used cargo test --no-default-features to skip PipeWire feature during testing

Compilation Errors

E0433: Unresolved Module tungstenite

  • Error: Could not resolve tungstenite::Error type
  • Cause: Import statement only imported specific items, not the full module
  • Solution: Added Error as WsError to tokio_tungstenite imports
  • Pattern: Use type aliasing for frequently used imported types

E0599: No Method next

  • Error: WebSocketStream didn't have next() method in scope
  • Cause: Missing StreamExt trait from futures crate
  • Solution: Added use futures::StreamExt to imports
  • Lesson: WebSocketStream implements Sink and Stream traits from futures, both needed

E0282: Type Annotations Needed

  • Error: Compiler couldn't infer error types in closures
  • Affected locations: handle_client message variable, multiple error closures
  • Solution: Added explicit type annotations: let msg: Message, |e: WsError|
  • Pattern: Async WebSocket code frequently requires explicit type annotations

Missing Error Variant

  • Error: Used SignalingError::SessionNotFound which doesn't exist
  • Root Cause: Error exists in WebRtcError enum, not SignalingError
  • Solution: Changed to SignalingError::ProtocolError with descriptive format string
  • Alternative: Could add SessionNotFound variant to SignalingError enum

Code Organization Issues

Duplicate Struct Definition

  • Issue: Initially had both placeholder and complete SignalingServer struct definitions
  • Cause: Added new struct without removing old placeholder
  • Detection: Compiler reported "unclosed delimiter" error
  • Solution: Removed old placeholder struct definition
  • Prevention: Always review file for duplicates before major edits

Testing Considerations

Port Conflicts

  • Issue: Default port 8765 might conflict during concurrent test runs
  • Solution: Used ephemeral ports (18765+) for test instances
  • Pattern: Add test port offset (10000+) to default ports

Dependency Testing

  • Issue: Full build requires PipeWire system libraries
  • Solution: Test with --no-default-features to test core functionality
  • Trade-off: Can't test integration with features disabled