pusher / pusher-http-php

PHP library for interacting with the Pusher Channels HTTP API
https://pusher.com/docs/server_api_guide
1.4k stars 306 forks source link

Add the ability to set Guzzle config from $options #362

Closed kharanenka closed 1 year ago

kharanenka commented 1 year ago

Right now new object of Guzzle is created without any parameters. For example: there is no way to disable SSL verification check. It will be useful to add the ability to set Guzzle settings from $options array.

benw-pusher commented 1 year ago

You can create a custom Guzzle client using the method described at https://github.com/pusher/pusher-http-php#custom-guzzle-client. Does this work for you?

kharanenka commented 1 year ago

For example: I uses Laravel 8 in my project. Laravel has simple interface for broadcasting in core class \Illuminate\Broadcasting\BroadcastManager::createPusherDriver()

 $pusher = new Pusher(
    $config['key'], $config['secret'],
    $config['app_id'], $config['options'] ?? []
);

Laravel doesn't have possibility to pass custom object of Guzzle. I can trasfer setting to Guzzle only via $options array. I uses own local Pusher server for web-sockets for my project. Web-socket server uses self-signed SSL certificate for local development.

I can disable of SSL check in previous version on Pusher package via Laravel config (docs).

It would be cool to keep this feature for such rare cases.

benw-pusher commented 1 year ago

The approach for this library is to pass a custom Guzzle client as mentioned. It may be that Laravel needs to add support for this if this is a wide requested feature. We aren't able to support Pusher replacement services such as laravel-websockets.