{"id":22172942,"url":"https://github.com/happones/nativescript-laravel-echo","last_synced_at":"2025-07-26T14:31:28.225Z","repository":{"id":57308645,"uuid":"141756819","full_name":"happones/nativescript-laravel-echo","owner":"happones","description":"A nativescript plugin for laravel-echo","archived":false,"fork":false,"pushed_at":"2019-09-11T15:06:46.000Z","size":2138,"stargazers_count":10,"open_issues_count":8,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-10T23:32:55.811Z","etag":null,"topics":["laravel-echo","nativescript","nativescript-plugin","pusher","socket-io"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/happones.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-20T20:55:21.000Z","updated_at":"2024-05-30T16:13:46.000Z","dependencies_parsed_at":"2022-08-28T23:30:37.162Z","dependency_job_id":null,"html_url":"https://github.com/happones/nativescript-laravel-echo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happones%2Fnativescript-laravel-echo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happones%2Fnativescript-laravel-echo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happones%2Fnativescript-laravel-echo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happones%2Fnativescript-laravel-echo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/happones","download_url":"https://codeload.github.com/happones/nativescript-laravel-echo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227598458,"owners_count":17791605,"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":["laravel-echo","nativescript","nativescript-plugin","pusher","socket-io"],"created_at":"2024-12-02T07:27:53.484Z","updated_at":"2024-12-02T07:27:54.072Z","avatar_url":"https://github.com/happones.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NativeScript Laravel-Echo\n\n[![npm](https://img.shields.io/npm/v/nativescript-laravel-echo.svg)](https://www.npmjs.com/package/nativescript-laravel-echo)\n[![npm](https://img.shields.io/npm/dt/nativescript-laravel-echo.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-laravel-echo)\n\n[![NPM](https://nodei.co/npm/nativescript-laravel-echo.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://npmjs.org/package/nativescript-laravel-echo)\n\nThis is a [laravel-echo](https://github.com/laravel/echo/blob/master/src/channel/pusher-channel.ts) plugin for native applications made with nativescript\n\nFor more information read [Laravel Broadcast](https://laravel.com/docs/master/broadcasting). \n\n## Prerequisites / Requirements\n\nNecesary api authentication in your laravel backend application.\n\n**Modify the file where the following line `Broadcast::routes()`**\n\nExample in `app/Providers/BroadcastServiceProvider.php`\n\n```php\nclass BroadcastServiceProvider extends ServiceProvider\n{\n    /**\n     * Bootstrap any application services.\n     *\n     * @return void\n     */\n    public function boot()\n    {\n        Broadcast::routes(['middleware' =\u003e 'auth:api']);\n        require base_path('routes/channels.php');\n    }\n}\n```\n\n## Installation\n\nDescribe your plugin installation steps. Ideally it would be something like:\n\n`$ tns plugin add nativescript-laravel-echo`\n\n## Usage \n\n```php\nnamespace App\\Events;\n\nuse Illuminate\\Broadcasting\\Channel;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Broadcasting\\PrivateChannel;\nuse Illuminate\\Broadcasting\\PresenceChannel;\nuse Illuminate\\Broadcasting\\InteractsWithSockets;\nuse Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast;\n\nclass Event implements ShouldBroadcast\n{\n    /**\n     * Information about the shipping status update.\n     *\n     * @var string\n     */\n    public $data; //data show in console.dir as data\n}\n```\n\n\n**Javascript**\t\n```javascript\nconst TnsEcho = require('nativescript-laravel-echo').TnsEcho;\n\nconst token = 'Asdsd3dsdsTytf';//Your token\n\nconst options = {\n    //....\n    broadcaster: 'socket.io',// pusher,\n    headers: {\n        auth: {\n            bearer: `Bearer ${token}`\n        }\n    }\n}\n\nconst Echo = new TnsEcho(options)\n\nEcho.channel('YourChannel').listen('Event', e =\u003e {\n    console.dir(e)\n})\n\n//presence channel for others\nconst http = require('tns-core-modules/http');\n\nhttp.request({\n    //....\n    headers: {\n        //...\n        'X-Socket-Id': Echo.socketId() // get socket id\n    }\n});\n```\n    \n    \n**TypeScript**\t  \n```typescript\nimport { TnsEcho } from 'nativescript-laravel-echo';\n\nconst token = 'Asdsd3dsdsTytf';//Your token\n\nconst options = {\n    //....\n    broadcaster: 'socket.io',// pusher,\n    headers: {\n        auth: {\n            bearer: `Bearer ${token}`\n        }\n    }\n}\n\nthis.Echo = new TnsEcho(options)\n\nthis.Echo.channel('YourChannel').listen('Event', e =\u003e {\n    console.dir(e)\n})\n\n//presence channel for others\nimport * as http from 'tns-core-modules/http';\n\nhttp.request({\n    //....\n    headers: {\n        //...\n        'X-Socket-Id': this.Echo.socketId() // get socket id\n    }\n})\n```\n\n## Options\n\nThese are each of the parameters that can go in the object options.\n    \n| Property | Default | Description |\n| --- | --- | --- |\n| broadcaster | pusher | Driver for broadcast pusher or socket.io |\n| host | null | Your host only socket.io |\n| authEndpoint | /broadcasting/auth | Your auth endpoint only for Pusher |\n| key | null | Your api key of Pusher App |\n| cluster | null | Your cluster of Pusher App |\n| auth | auth:{headers:{}} | Necesary in private an presence channel's with Authorization header |\n| namespace | App.Events | The namespace backend events |\n| debug | false | Enable debug only socket.io broadcaster |\n| forceWebsockets | false | Force WebSockets |\n    \n## License\n\nApache License Version 2.0, January 2004\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappones%2Fnativescript-laravel-echo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappones%2Fnativescript-laravel-echo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappones%2Fnativescript-laravel-echo/lists"}