Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

CrastyCrap's avatar

Pusher error: cURL error 6: Could not resolve host: api-.pusher.com

i am trying to use pusher in my application , but i got the following problem

Pusher error: cURL error 6: Could not resolve host: api-.pusher.com

at it take place when i add channel to my broadcast event

ContactEvent

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ContactEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    public function broadcastWith()
    {
        return [
            'message' => 'Hello'
        ];
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('contact');
    }
}

model

class Contact extends Model
{
    use HasFactory;

    protected $fillable = ['name','surname','email','message'];

    static function createInstance($request)
    {
        self::create($request);
        broadcast(new ContactEvent('event'));
    }
}

channel.php

Broadcast::channel('contact', function ($user, $orderId) {
    return true;
});
0 likes
4 replies
DhPandya's avatar

@CrastyCrap Try clearing your configuration cache. php artisan config:clear or php artisan optimize:clear

Before clearing this make sure you've added your pusher settings In your .env file.

arijitpaul062's avatar

@crastycrap Trigger your

$options = array( 'cluster' => 'ap2', 'useTLS' => true ); $pusher = new Pusher( env('PUSHER_APP_KEY'), env('PUSHER_APP_SECRET'), env('PUSHER_APP_ID'), $options );

'useTLS' => true it will work if you add this

Please or to participate in this conversation.