@@ -1,32 +1,32 @@
|
||||
<?php
|
||||
//
|
||||
//namespace App\Events;
|
||||
//
|
||||
//use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
//use Illuminate\Broadcasting\PrivateChannel;
|
||||
//use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
||||
//use Illuminate\Foundation\Events\Dispatchable;
|
||||
//use Illuminate\Queue\SerializesModels;
|
||||
//
|
||||
//class MatchEnded implements ShouldBroadcastNow
|
||||
//{
|
||||
// use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
//
|
||||
// public $matchId;
|
||||
//
|
||||
// public function __construct($matchId)
|
||||
// {
|
||||
// $this->matchId = $matchId;
|
||||
// }
|
||||
//
|
||||
// public function broadcastOn()
|
||||
// {
|
||||
// // ارسال پیام به کانال پرایوت بازی که هر دو نفر داخل آن هستند
|
||||
// return new PrivateChannel('pvp-match.' . $this->matchId);
|
||||
// }
|
||||
//
|
||||
// public function broadcastAs()
|
||||
// {
|
||||
// return 'match.ended';
|
||||
// }
|
||||
//}
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class MatchEnded implements ShouldBroadcastNow
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $matchId;
|
||||
|
||||
public function __construct($matchId)
|
||||
{
|
||||
$this->matchId = $matchId;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
// ارسال پیام به کانال پرایوت بازی که هر دو نفر داخل آن هستند
|
||||
return new PrivateChannel('pvp-match.' . $this->matchId);
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'match.ended';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
<?php
|
||||
//
|
||||
//namespace App\Events;
|
||||
//
|
||||
//use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
//use Illuminate\Broadcasting\PrivateChannel;
|
||||
//use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
||||
//use Illuminate\Foundation\Events\Dispatchable;
|
||||
//use Illuminate\Queue\SerializesModels;
|
||||
//
|
||||
//class MatchStarted implements ShouldBroadcastNow
|
||||
//{
|
||||
// use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
//
|
||||
// public $matchData;
|
||||
// public $ticketId;
|
||||
//
|
||||
// public function __construct($matchData, $ticketId)
|
||||
// {
|
||||
// $this->matchData = $matchData;
|
||||
// $this->ticketId = $ticketId;
|
||||
// }
|
||||
//
|
||||
// public function broadcastOn()
|
||||
// {
|
||||
// // ارسال پیام به کانال پرایوت مختص تیکت کاربری که در صف انتظار بود
|
||||
// return new PrivateChannel('matchmaking.' . $this->ticketId);
|
||||
// }
|
||||
//
|
||||
// public function broadcastAs()
|
||||
// {
|
||||
// // نام ایونتی که کاتلین باید به آن گوش دهد
|
||||
// return 'match.started';
|
||||
// }
|
||||
//}
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class MatchStarted implements ShouldBroadcastNow
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $matchData;
|
||||
public $ticketId;
|
||||
|
||||
public function __construct($matchData, $ticketId)
|
||||
{
|
||||
$this->matchData = $matchData;
|
||||
$this->ticketId = $ticketId;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
// ارسال پیام به کانال پرایوت مختص تیکت کاربری که در صف انتظار بود
|
||||
return new PrivateChannel('matchmaking.' . $this->ticketId);
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
// نام ایونتی که کاتلین باید به آن گوش دهد
|
||||
return 'match.started';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user