{"id":23032501,"url":"https://github.com/jekabsilkens/websocket-notifs","last_synced_at":"2026-04-16T04:31:47.651Z","repository":{"id":267597835,"uuid":"901737601","full_name":"JekabsIlkens/websocket-notifs","owner":"JekabsIlkens","description":"Websocket notifications | Laravel | Reverb | Echo | Redis","archived":false,"fork":false,"pushed_at":"2024-12-13T09:06:46.000Z","size":459,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T20:37:38.358Z","etag":null,"topics":["laravel","redis","websocket"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JekabsIlkens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-11T08:15:20.000Z","updated_at":"2024-12-13T09:06:49.000Z","dependencies_parsed_at":"2024-12-11T09:33:17.265Z","dependency_job_id":"745a871a-7b7b-42f7-8c85-e4f4e08baccb","html_url":"https://github.com/JekabsIlkens/websocket-notifs","commit_stats":null,"previous_names":["jekabsilkens/websocket-notifs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JekabsIlkens/websocket-notifs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JekabsIlkens%2Fwebsocket-notifs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JekabsIlkens%2Fwebsocket-notifs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JekabsIlkens%2Fwebsocket-notifs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JekabsIlkens%2Fwebsocket-notifs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JekabsIlkens","download_url":"https://codeload.github.com/JekabsIlkens/websocket-notifs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JekabsIlkens%2Fwebsocket-notifs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31871472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","redis","websocket"],"created_at":"2024-12-15T15:53:21.790Z","updated_at":"2026-04-16T04:31:47.634Z","avatar_url":"https://github.com/JekabsIlkens.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebSocket notifications (proof of concept)\n\n## Table of contents:\n- **[Functionality preview](#functionality-preview)**\u003cbr/\u003e\n- **[Project description](#project-description)**\u003cbr/\u003e\n- **[Potential improvements](#potential-improvements)**\u003cbr/\u003e\n- **[Installation instructions](#installation-instructions)**\u003cbr/\u003e\n\n## Functionality preview:\n\nUsing an incognito tab (on the right side), I am simulating actions on the server. The WebSocket listens for these events and displays them in real time (on the left side).\nIn Devtools/Network/WS we can see a successful subscription to the new-notifications channel and the contents of a received event.\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src='https://raw.githubusercontent.com/JekabsIlkens/websocket-notifs/master/public/images/ws_preview.gif' alt='websocket_preview' width=\"500px\"/\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src='https://raw.githubusercontent.com/JekabsIlkens/websocket-notifs/master/public/images/custom_key.png' alt='websocket_custom' width=\"600px\"/\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd colspan=\"2\"\u003e\u003cimg src='https://raw.githubusercontent.com/JekabsIlkens/websocket-notifs/master/public/images/ws_devtools.png' alt='websocket_devtools' width=\"1200px\"/\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Project description:\n\n### Problem Statement\nThe project addresses the need for real-time data delivery from the server to the browser.\nTraditional HTTP-based communication is not sufficient for instantaneous updates as it relies on request-response cycles.\nLeveraging WebSockets we can enable seamless, bi-directional communication, which allows the server to push data directly to the client.\nThis is ideal for applications requiring live updates, such as live feeds, or real-time notifications. \u003cbr/\u003e\n\n### Success Metrics\nDemonstrate a functional client-server WebSocket notification system with a simple single channel and event implementation. \u003cbr/\u003e\n- Clients receive real-time updates pushed from the server.\n- Data is displayed accurately and instantaneously in the browser.\n\n### Implementation\n- **Server Side**: Laravel 11 and Reverb to broadcast data to connected clients via WebSockets.\n- **Client Side**: Laravel Echo and JavaScript to listen for events, and display the received data.\n- **Data Storage**: Redis for easy and simple session and new notification storage.\n\n## Potential improvements:\n\n### The current setup:\nDirectly firing an event after inserting data into Redis. This ensures that the WebSocket is triggered immediately after the data is added.\nSimple implementation with an immediate response to the insert, so users see notifications as soon as the data is inserted, but slightly less scalable in case of heavy traffic. \u003cbr/\u003e\n\n### Alternative approach:\nListen for changes in Redis through Pub/Sub and trigger an event when new data is inserted. \nThis approach is more scalable, but introduces more complexity.\nConsidering that this is a simple proof of concept to demonstrate real-time data via WebSockets, the current implementation is simple and sufficient for the goal.\nWhen implementing into a real system we would naturally anticipate heavy traffic and the need for better decoupling of the event system with Redis Pub/Sub which would allow events to be triggered asynchronously.\n\n## Installation instructions:\n\n### Ensure you have the following tools:\n- PHP (version 8.2 or later)\n- Composer (for PHP dependencies)\n- Node/npm (for frontend dependencies)\n- Redis (for a local Redis server)\n\n### Clone the repository on your local machine \u0026 step into the project directory:\n```shell\ngit clone https://github.com/JekabsIlkens/websocket-notifs.git\n\ncd websocket-notifs\n```\n\n### Open .env.example \u0026 add your Redis server credentials:\n```shell\nREDIS_CLIENT=predis\nREDIS_HOST=127.0.0.1\nREDIS_PASSWORD=null\nREDIS_PORT=6379\nREDIS_DB=0\nREDIS_CACHE_DB=1\nREDIS_NOTIFICATIONS_DB=2\n```\n\n### Run the setup script to build the project:\n```shell\nsetup.bat\n```\n\n### Run the start script to launch the project:\n```shell\nstart.bat\n```\n\n### For Linux \u0026 MacOS, please execute these commands manually:\n```shell\ncopy .env.example .env              # Creates the environment configuration file\ncomposer install                    # Installs the required PHP dependencies\nnpm install                         # Installs the required front-end dependencies\nnpm run build                       # Builds the required front-end assets\nphp artisan key:generate            # Generates the application key\n\nphp artisan serve                   # Starts the PHP development server\nphp artisan reverb:start            # Starts the Reverb development server\nnpm run dev                         # Starts the Vite development server\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjekabsilkens%2Fwebsocket-notifs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjekabsilkens%2Fwebsocket-notifs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjekabsilkens%2Fwebsocket-notifs/lists"}