The wirechat:setup-notifications command configures browser push notifications for WireChat by creating the necessary service worker files in your public directory.
If public/sw.js already exists, the command will NOT overwrite it. Instead, you’ll see:
⚠️ A service worker (sw.js) already exists in the public directory.To use Wirechat notifications, add the following at the top of your service worker file:`importScripts('/js/wirechat/sw.js');`
If you already have a custom service worker, you must manually integrate the WireChat service worker by adding the importScripts line.
$ php artisan wirechat:setup-notificationsSetting up Notifications...Creating Wirechat service worker script...✅ Wirechat service worker script successfully created at `js/wirechat/sw.js`.Creating main service worker script...✅ Created `sw.js` in the public directory.✅ Wirechat notifications setup complete!Note: If you're already using a custom service worker in your application, you need to manually add `importScripts('/js/wirechat/sw.js');` to your existing service worker file and update the notifications.main_sw_script value in config/wirechat.php to point to your service worker file.Finally, ensure that `notifications.enabled` is set to true in your Wirechat config.
$ php artisan wirechat:setup-notificationsSetting up Notifications...Creating Wirechat service worker script...✅ Wirechat service worker script successfully created at `js/wirechat/sw.js`.Creating main service worker script...⚠️ A service worker (sw.js) already exists in the public directory.To use Wirechat notifications, add the following at the top of your service worker file:`importScripts('/js/wirechat/sw.js');`✅ Wirechat notifications setup complete!