Open madfortech opened 2 weeks ago
Not sure why you need to create AblyRest
instance
/**
* Execute the job.
*/
public function handle(): void
{
$ably = new Ably\AblyRest(env('ABLY_KEY'));
$channel = $ably->channels->get($this->channelName);
$channel->publish('message', $this->message);
}
Broadcaster automatically create instance here, you might like to reuse the same -> https://github.com/ably/laravel-broadcaster/blob/082d4e01b81048d33e8b2d04d998d6e70f3bb057/src/LaravelAblyBroadcasterServiceProvider.php#L16-L24.
and we don't support realtime instance creation
public function publishMessage($message)
{
$ably = new AblyRealtime(env('ABLY_KEY'));
$channel = $ably->channels->get($this->channelName);
$channel->publish('message', $message);
}
I feel you might like to refer to official doc https://laravel.com/docs/10.x/broadcasting, on how to use laravel-broadcaster as a part of jobs mechanism. I don't feel need to create separate AblyRest
instance, instead it should be inferred from laravel-broadcaster/src/LaravelAblyBroadcasterServiceProvider.php
ably/ably-php": "^1.1",
ABLY_KEY=my key BROADCAST_DRIVER=ably ABLY_DISABLE_PUBLIC_CHANNELS=true ABLY_TOKEN_EXPIRY=21600 ABLY_SYNC_SERVER_TIME=true
Php version PHP 8.1.17 Laravel Framework 10.48.22 Any one help me i will make a project use Laravel
┆Issue is synchronized with this Jira Task by Unito