Skip to content

Conversation

@Saad5400
Copy link

Introduced a flexible adapter pattern for signaling servers, allowing users to choose between different signaling mechanisms or create custom adapters.

Changes:

  • Created SignalingAdapter base class with standard interface
  • Implemented DefaultSignalingAdapter maintaining existing WebSocket behavior
  • Implemented LaravelEchoAdapter for Laravel Echo integration
  • Refactored SignalingConn to use adapters via composition
  • Updated WebrtcProvider to accept adapter instances or URLs
  • Added comprehensive documentation for using and creating adapters

Benefits:

  • Backward compatible - existing code continues to work unchanged
  • Users can integrate with existing real-time infrastructure (Laravel Echo, etc.)
  • Easy to create custom adapters for other platforms (Socket.io, Ably, etc.)
  • Can mix multiple adapter types for redundant signaling paths

The WebRTC and P2P functionality remains unchanged - only the signaling mechanism is abstracted.

Introduced a flexible adapter pattern for signaling servers, allowing users to
choose between different signaling mechanisms or create custom adapters.

Changes:
- Created SignalingAdapter base class with standard interface
- Implemented DefaultSignalingAdapter maintaining existing WebSocket behavior
- Implemented LaravelEchoAdapter for Laravel Echo integration
- Refactored SignalingConn to use adapters via composition
- Updated WebrtcProvider to accept adapter instances or URLs
- Added comprehensive documentation for using and creating adapters

Benefits:
- Backward compatible - existing code continues to work unchanged
- Users can integrate with existing real-time infrastructure (Laravel Echo, etc.)
- Easy to create custom adapters for other platforms (Socket.io, Ably, etc.)
- Can mix multiple adapter types for redundant signaling paths

The WebRTC and P2P functionality remains unchanged - only the signaling
mechanism is abstracted.
The adapter now properly handles Echo channel subscription timing by:
- Tracking channel ready state with subscribed() callback
- Queuing messages until subscription_succeeded event fires
- Automatically flushing queued messages when channel is ready
- Adding error handling for subscription failures

This prevents the "Client event triggered before channel 'subscription_succeeded'"
warning and ensures all signaling messages are delivered reliably.
Updated package.json exports to use modern conditional exports format
with "types" condition placed first for better TypeScript resolution.

Changes:
- Restructured exports field to use conditional exports properly
- "types" condition now comes first for TypeScript tooling
- Regenerated all TypeScript declaration files with latest changes
- Verified type checking with test compilation

This fixes the "Could not find a declaration file" error in Vue and
other TypeScript projects.
@Saad5400
Copy link
Author

Saad5400 commented Nov 4, 2025

Ok so this is an actual issue I ran into, I'm using Laravel echo (echo is the client-side sdk that follows the reverb protocol) and the current implementation has fixed connection messages and types, which aren't compatible with Laravel echo.

I thought I'd try to use claude code to refactor the signaling server login into a separate "adapter" class, so that anyone can implement their own adapter with their own sdk or custom messages and types etc ...

It did great (claude code) and the output is exactly that, extracted websocket logic into adapters.

@Saad5400
Copy link
Author

Saad5400 commented Nov 4, 2025

Closes #68

@Saad5400
Copy link
Author

Saad5400 commented Nov 4, 2025

@dmonad I'd really appreciate it if you have some time to look into this, and if not I still appreciate your work, it's great and I'm using my own fork for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants