{"id":23116065,"url":"https://github.com/py-package/masonite-socketio-driver","last_synced_at":"2025-08-16T21:32:19.563Z","repository":{"id":50480364,"uuid":"445831775","full_name":"py-package/masonite-socketio-driver","owner":"py-package","description":"Extends default masonite broadcast driver to support SocketIO","archived":false,"fork":false,"pushed_at":"2024-03-11T18:17:54.000Z","size":110,"stargazers_count":12,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T18:18:35.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/py-package.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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}},"created_at":"2022-01-08T13:48:39.000Z","updated_at":"2024-05-23T06:35:00.000Z","dependencies_parsed_at":"2024-03-06T13:38:36.940Z","dependency_job_id":null,"html_url":"https://github.com/py-package/masonite-socketio-driver","commit_stats":{"total_commits":35,"total_committers":3,"mean_commits":"11.666666666666666","dds":"0.17142857142857137","last_synced_commit":"572bebbedfeff41e030dff4ef594c02ad9fd28ae"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/py-package/masonite-socketio-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-package%2Fmasonite-socketio-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-package%2Fmasonite-socketio-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-package%2Fmasonite-socketio-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-package%2Fmasonite-socketio-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/py-package","download_url":"https://codeload.github.com/py-package/masonite-socketio-driver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-package%2Fmasonite-socketio-driver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270775799,"owners_count":24642961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"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":[],"created_at":"2024-12-17T04:10:50.139Z","updated_at":"2025-08-16T21:32:19.056Z","avatar_url":"https://github.com/py-package.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://banners.beyondco.de/Masonite%20SocketIO%20Driver.png?theme=light\u0026packageManager=pip+install\u0026packageName=masonite-socketio-driver\u0026pattern=charlieBrown\u0026style=style_2\u0026description=Driver+support+for+SocketIO+in+masonite+4.\u0026md=1\u0026showWatermark=1\u0026fontSize=100px\u0026images=adjustments\u0026widths=50\u0026heights=50\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/masonite-socketio-driver\"\u003e\n  \u003cimg alt=\"issues\" src=\"https://img.shields.io/github/issues/py-package/masonite-socketio-driver\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/python-3.7+-blue.svg\" alt=\"Python Version\"\u003e\n  \u003cimg alt=\"GitHub release (latest by date including pre-releases)\" src=\"https://img.shields.io/github/v/release/py-package/masonite-socketio-driver\"\u003e\n  \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/py-package/masonite-socketio-driver\"\u003e\n  \u003ca href=\"https://github.com/py-package/masonite-socketio-driver/stargazers\"\u003e\u003cimg alt=\"star\" src=\"https://img.shields.io/github/stars/py-package/masonite-socketio-driver\" /\u003e\u003c/a\u003e\n  \u003cimg alt=\"downloads\" src=\"https://img.shields.io/pypi/dm/masonite-socketio-driver?style=flat\" /\u003e\n  \u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## SocketIO Driver\n\nIt's an extra broadcast driver support for SocketIO in masonite 4, it extends default masonite broadcast driver to support SocketIO.\n\n**Masonite Broadcast Server and Client Library**\n- [x] [Broadcast Server](https://github.com/py-package/masonite-broadcast-server)\n- [x] [broadcast Client](https://github.com/py-package/masonite-broadcast-client)\n\n**Setup**\n\nInstall package using pip:\n\n```shell\npip install masonite-socketio-driver\n```\n\nAdd provider inside config/providers.py.\n\n```python\nfrom socketio_driver.providers import SocketProvider\n\nPROVIDERS = [\n    ...,\n    # Application Providers\n    SocketProvider,\n]\n```\n\n**Driver Config**\nAdd following configuration inside config/broadcast.py after `\"pusher\": {...},`\n\n```python\n\"pusher\": {...},\n\"socketio\": {\n    \"driver\": \"socketio\",\n    \"host\": env(\"BROADCAST_HOST\", \"localhost\"),\n    \"port\": env(\"BROADCAST_PORT\", \"6379\")\n},\n```\n\nAdd following keys in `.env`.\n\n```shell\nBROADCAST_HOST=\nBROADCAST_PORT=\n```\n\nUpdate the broadcast driver value to `socketio` in `.env`\n\n```shell\nBROADCAST_DRIVER=socketio\n```\n\n**Example**\n\n```python\n# broadcast to given channels\n\nfrom masonite.controllers import Controller\nfrom masonite.broadcasting import Broadcast\n\nclass YourController(Controller):\n\n    def your_function(self, broadcast: Broadcast):\n        broadcast_data = {\n            \"message\": \"Hello World\"\n        }\n        broadcast.channel([\"channel-name\"], \"event-name\", broadcast_data)\n```\n\n```python\n# broadcast to selected users/clients\n\nfrom masonite.controllers import Controller\nfrom masonite.broadcasting import Broadcast\nfrom socketio_driver.facades import Communicator\n\nclass YourController(Controller):\n\n    def your_function(self, broadcast: Broadcast):\n        broadcast_data = {\n            \"message\": \"Hello World\"\n        }\n        clients = Communicator.clients()\n        ids = [client.socketID for client in clients]\n        broadcast.channel(ids, \"event-name\", broadcast_data)\n\n\n    def or_another_function(self, broadcast: Broadcast):\n        broadcast_data = {\n            \"message\": \"Hello World\"\n        }\n        clients = Communicator.clients()\n        broadcast.driver(\"socketio\").user(clients[0]).send(\"event-name\", broadcast_data)\n```\n\n**Helpers**\n\nFacade helpers...\n\n```python\nfrom socketio_driver.facades import Communicator\n```\n\n```python\n# List all clients:  \nCommunicator.clients()\n```\n```python\n# Get client by sessionID\nCommunicator.client(id='client-session-id')\n```\n```python\n# Delete all clients\nCommunicator.delete_all_clients()\n```\n```python\n# Delete client by SocketClient instance\nCommunicator.delete(client)\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy-package%2Fmasonite-socketio-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpy-package%2Fmasonite-socketio-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy-package%2Fmasonite-socketio-driver/lists"}