承接 tomato-technologies/tomato-pusher-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tomato-technologies/tomato-pusher-php

Composer 安装命令:

composer require tomato-technologies/tomato-pusher-php

包简介

Tomato pusher for Laravel project

README 文档

README

Installation

composer require tomatotech/tomato_pusher_php

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Laravel 5.5+:

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

Tomato\Pusher\ServiceProvider::class,

If you want to make it easier to access Pusher or Event class, add this to your facades in app.php:

'TomatoPusher' => Tomato\Pusher\Facade::class,
'TomatoEvent'  => Tomato\Pusher\Events\Event::class,

Usage

Before usage, please remember to set your App Id and App secret in config/services.php, They are assigned to you via tomato-pusher-server's .env file

    "tomato_pusher" => [
        'app_id' => env('TOMATO_PUSHER_APP_ID'),
        'app_secret' => env('TOMATO_PUSHER_APP_SECRET'),
    ],

You need to get the JWT token generated by this pusher and the APP Id and pass them to your socket.io client:

$appId=TomatoPusher::getAppId();
//or $appId=config("services.tomato_pusher.app_id");
$token=TomatoPusher::getToken();

Here is a example how your will use them in your socket.io client:

var socket = io('http://localhost:37037/{{$appId}}',{
    rememberUpgrade:true,
    query:{
        channel:"{{your-channel-name}}",
        token:"{{$token}}"
    },
});

socket.on('{{your-event-name}}', function(data){
    console.log(data);
});

Broadcasting

To broadcast event to you socket.io client:

$data=["id"=>1,"name"=>"Sydney day tour","price"=>100.5];
event(new TomatoEvent('your-channnel-name','your-event-name',$data));

Please remember to run make queue listening if you don't using the sync drive for queue

php artisan queue:listen

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固