Skip to content

Commit 4cf58c2

Browse files
committed
2 parents d517abe + d95e8f6 commit 4cf58c2

File tree

1 file changed

+87
-45
lines changed

1 file changed

+87
-45
lines changed

README.md

Lines changed: 87 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,108 @@
1-
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
1+
# Laravel WebRTC with Reverb & Echo
22

3-
<p align="center">
4-
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
5-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
6-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
7-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
8-
</p>
3+
This project integrates WebRTC with Laravel Reverb and Laravel Echo, enabling real-time peer-to-peer communication using Laravel’s native WebSocket capabilities.
94

10-
## Laravel Echo WebRTC Demo
5+
## Features
6+
• Real-Time Communication: Uses WebRTC for live audio and video calls.
7+
• WebSockets with Laravel Reverb: Provides scalable and low-latency signaling for WebRTC.
8+
• Laravel Echo Integration: Handles WebSocket events seamlessly.
9+
• Vue.js Frontend: A dynamic and interactive UI built with Vue.js.
10+
• Self-Hosted WebSocket Server: No need for third-party WebSocket services.
1111

12-
This repo utilizes Laravel Echo to build a signaling server for WebRTC requests.
12+
## Prerequisites
13+
• PHP 8+
14+
• Laravel 10+
15+
• Composer
16+
• Node.js & npm
17+
• SQLite, MySQL, or PostgreSQL
1318

14-
- [Simple, fast routing engine](https://laravel.com/docs/routing).
15-
- [Powerful dependency injection container](https://laravel.com/docs/container).
16-
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
17-
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
18-
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
19-
- [Robust background job processing](https://laravel.com/docs/queues).
20-
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
19+
Installation
20+
1. Clone the Repository:
2121

22-
Laravel is accessible, powerful, and provides tools required for large, robust applications.
22+
git clone https://github.com/mastashake08/laravel-webrtc.git
23+
cd laravel-webrtc
2324

24-
## Learning Laravel
2525

26-
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
26+
2. Install Dependencies:
2727

28-
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
28+
composer install
29+
npm install
2930

30-
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
3131

32-
## Laravel Sponsors
32+
3. Environment Configuration:
33+
• Duplicate .env.example and rename it to .env.
34+
• Update your database settings.
35+
• Set the WebSockets connection driver:
3336

34-
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
37+
BROADCAST_DRIVER=pusher
38+
PUSHER_APP_ID=reverb
39+
PUSHER_APP_KEY=reverb
40+
PUSHER_APP_SECRET=reverb
3541

36-
### Premium Partners
3742

38-
- **[Vehikl](https://vehikl.com/)**
39-
- **[Tighten Co.](https://tighten.co)**
40-
- **[WebReinvent](https://webreinvent.com/)**
41-
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
42-
- **[64 Robots](https://64robots.com)**
43-
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
44-
- **[Cyber-Duck](https://cyber-duck.co.uk)**
45-
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
46-
- **[Jump24](https://jump24.co.uk)**
47-
- **[Redberry](https://redberry.international/laravel/)**
48-
- **[Active Logic](https://activelogic.com)**
49-
- **[byte5](https://byte5.de)**
50-
- **[OP.GG](https://op.gg)**
43+
• Generate an application key:
5144

52-
## Contributing
45+
php artisan key:generate
5346

54-
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
5547

56-
## Code of Conduct
48+
4. Run Database Migrations:
5749

58-
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
50+
php artisan migrate
5951

60-
## Security Vulnerabilities
6152

62-
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
53+
5. Start Laravel Reverb (WebSocket Server):
6354

64-
## License
55+
php artisan reverb:start
6556

66-
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
57+
58+
6. Start the Laravel Application:
59+
60+
php artisan serve
61+
62+
63+
7. Compile Frontend Assets:
64+
65+
npm run dev
66+
67+
Or for production:
68+
69+
npm run build
70+
71+
72+
73+
WebRTC Signaling Flow
74+
1. User joins a call → Laravel Echo broadcasts an event via Reverb.
75+
2. New peer detected → WebRTC initiates a peer-to-peer connection.
76+
3. ICE Candidates exchanged → STUN/TURN servers handle NAT traversal.
77+
4. Media streams established → Users can see and hear each other.
78+
79+
Configuration for Laravel Echo
80+
81+
Your resources/js/bootstrap.js should have the following:
82+
83+
import Echo from 'laravel-echo';
84+
85+
window.Pusher = require('pusher-js');
86+
87+
window.Echo = new Echo({
88+
broadcaster: 'pusher',
89+
key: 'reverb',
90+
wsHost: window.location.hostname,
91+
wsPort: 6001,
92+
forceTLS: false,
93+
disableStats: true,
94+
});
95+
96+
Usage
97+
1. Open two different browser windows (or devices).
98+
2. Start a call and invite the other participant.
99+
3. Laravel Reverb will handle WebSocket signaling.
100+
4. WebRTC will establish the peer-to-peer connection.
101+
102+
Contributing
103+
104+
Contributions are welcome! Please fork the repo and submit a pull request.
105+
106+
License
107+
108+
This project is open-source under the MIT License.

0 commit comments

Comments
 (0)