I’m trying to implement a real-time notification system in my Laravel application. The frontend uses jQuery, and the backend uses Laravel’s broadcasting system with Reverb (also tried with Octane and Laravel WebSockets). Everything works perfectly in my local development environment, but in production the WebSocket connection consistently fails. The browser console shows errors like “WebSocket connection could not be established” or “Failed to establish WebSocket connection.” My SSL configuration is valid, the app is running over HTTPS, and all related environment variables seem correct. I’ve already tried adjusting broadcast drivers, checking ports, restarting services, clearing config caches, and testing different Reverb/WebSocket setups, but the issue only appears in production. I’m looking for guidance on what might cause WebSockets to fail only in production and what the correct deployment or configuration steps would be for Laravel Reverb/WebSockets on a live server—especially when using jQuery and not using Node.js or a typical frontend build pipeline.

3 Replies 3

Check on your server production if there are any firewall block it and check the configuration file for your WebSocket server (Laravel WebSockets config or Reverb) to ensure it's listening for wss:// connections. For Laravel WebSockets, the config file is typically config/websockets.php

i am usiing laravel 11. i dont have any websocket.php file in my project

When WebSockets work locally but fail in production, it’s almost always the server/proxy, not Laravel.

Check these 3 things:

1, Nginx/Apache must allow WebSocket upgrade headers: Upgrade / Connection: upgrade

2, Use wss:// in production (not ws://).

3, WebSocket port must be open and the Reverb/WebSocket process must be running (Supervisor/systemd).

If any of these are wrong, the browser will fail the connection every time.

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.