Laravel Video Chat using Socket.IO and WebRTC
Laravel Video Chat using Socket.IO and WebRTC
Laravel Video Chat using Socket.IO and WebRTC
composer require php-junior/laravel-video-chatLaravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
PhpJunior\LaravelVideoChat\LaravelVideoChatServiceProvider::class,php artisan vendor:publish --provider="PhpJunior\LaravelVideoChat\LaravelVideoChatServiceProvider"And
php artisan migrate
php artisan storage:link
change APP_URL in .envThis is the contents of the published config file:
…Uncomment App\Providers\BroadcastServiceProvider in the providers array of your config/app.php configuration file
Install the JavaScript dependencies:
npm install
npm install --save laravel-echo js-cookie vue-timeago socket.io socket.io-client webrtc-adapter vue-chat-scrollIf you are running the Socket.IO server on the same domain as your web application, you may access the client library like
in your application's head HTML element
Next, you will need to instantiate Echo with the socket.io connector and a host.
require('webrtc-adapter');
window.Cookies = require('js-cookie');
import Echo from "laravel-echo"
window.io = require('socket.io-client');
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});Finally, you will need to run a compatible Socket.IO server. Use tlaverdure/laravel-echo-server GitHub repository.
In resources/assets/js/app.js file:
…Run npm run dev to recompile your assets.
$groups = Chat::getAllGroupConversations();
$conversations = Chat::getAllConversations()…Chat::startConversationWith($otherUserId);Chat::acceptMessageRequest($conversationId);$conversation = Chat::getConversationMessageById($conversationId);user() }}">You can change message send route in component
Chat::sendConversationMessage($conversationId, $message);You can change video call route . I defined video call route trigger/{id} method POST
Use $request->all() for video call.
Chat::startVideoCall($conversationId , $request->all());Chat::createGroupConversation( $groupName , [ $otherUserId , $otherUserId2 ]);$conversation = Chat::getGroupConversationMessageById($groupConversationId);user() }}">You can change message send route in component
Chat::sendGroupConversationMessage($groupConversationId, $message);Chat::addMembersToExistingGroupConversation($groupConversationId, [ $otherUserId , $otherUserId2 ])Chat::removeMembersFromGroupConversation($groupConversationId, [ $otherUserId , $otherUserId2 ])Chat::leaveFromGroupConversation($groupConversationId);Run this command php artisan storage:link
Chat::sendFilesInConversation($conversationId , $request->file('files'));Chat::sendFilesInGroupConversation($groupConversationId , $request->file('files'));The MIT License (MIT). Please see License File for more information.
No open issues yet, or sync has not completed.