{"id":24233877,"url":"https://github.com/motia/laravel-echo-spa-plugin","last_synced_at":"2025-07-17T23:40:09.261Z","repository":{"id":98742690,"uuid":"226115540","full_name":"motia/laravel-echo-spa-plugin","owner":"motia","description":"A library to simplify the integration of Laravel Echo with your SPA/PWA","archived":false,"fork":false,"pushed_at":"2019-12-05T14:18:09.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-27T06:07:05.440Z","etag":null,"topics":["javascript","laravel-echo","laravel-echo-server","pwa","spa","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/motia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2019-12-05T14:03:25.000Z","updated_at":"2019-12-05T14:18:11.000Z","dependencies_parsed_at":"2023-03-13T15:55:06.663Z","dependency_job_id":null,"html_url":"https://github.com/motia/laravel-echo-spa-plugin","commit_stats":null,"previous_names":["motia/laravel-echo-module"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/motia/laravel-echo-spa-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motia%2Flaravel-echo-spa-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motia%2Flaravel-echo-spa-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motia%2Flaravel-echo-spa-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motia%2Flaravel-echo-spa-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/motia","download_url":"https://codeload.github.com/motia/laravel-echo-spa-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motia%2Flaravel-echo-spa-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264212214,"owners_count":23573691,"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","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":["javascript","laravel-echo","laravel-echo-server","pwa","spa","websocket"],"created_at":"2025-01-14T16:02:19.121Z","updated_at":"2025-07-17T23:40:09.014Z","avatar_url":"https://github.com/motia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Echo SPA Module\nA library to simplify the integration of Laravel Echo with your SPA/PWA\n\n# Setup\n```\nyarn add laravel-echo-spa-plugin\n```\n\nDefine env variables for your application\n```js\n  env: {\n    ECHO_AUTH_ENDPOINT: '/api/broadcasting/auth',\n    ECHO_HOST: 'http://echo-demo.test'\n  }\n```\n\n# Usage\n```js\nimport { createPlugin } from 'laravel-echo-spa-plugin'\n\nconst $echo = createPlugin()\n\n// load 'socket.io.js' dynamically if 'window.io' is not defined\n// no PROMISE is returned!\n// register your callbacks using $echo.onEchoReady\n$echo.loadScript()\n\n$echo.onEchoReady((echo) =\u003e {\n  // this is the Laravel Echo Instance\n  echo.private('room')\n    .listen(...)\n  // it can be accessed by $echo.echo\n  console.log(echo === $echo.echo) // true\n})\n\n// add token if you need private channels\n$echo.setToken('AUTH_TOKEN_FOR_PRIVATE_CHANNELS')\n\n// connect, this method will wait for the setup method to completes\n$echo.connect()\n\n// you can access the echo instance directly\n$echo.echo.private('room')\n  .listen(...)\n\n...\n\n// shutdown the echo instance\n$echo.close()\n// you can reconnect later\n$echo.connect()\n```\n# Nuxt.js Example\n```js\n// ~/plugins/echo.js\nimport Vue from 'vue'\nimport { createPlugin, registerAxiosInterceptor } from 'laravel-echo-spa-plugin'\n\nexport default function({ app, $axios }) {\n  const $echo = createPlugin()\n  Vue.prototype.$echo = app.$echo = $echo\n\n  // Support broadcasting to others for axios\n  if ($axios) {\n    registerAxiosInterceptor($axios)\n  }\n}\n\n// nuxt.config.js\n{\n  env: {\n    ECHO_AUTH_ENDPOINT: '/api/broadcasting/auth',\n    ECHO_HOST: 'http://echo-demo.test'\n  },\n\n  plugins: [\n    '~/plugins/echo'\n  ],\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmotia%2Flaravel-echo-spa-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmotia%2Flaravel-echo-spa-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmotia%2Flaravel-echo-spa-plugin/lists"}