Pollsockets is a simple, yet powerful, server-client communication library. It is designed to be used in situations where you need to send data from the server to the client. It is a great alternative to websockets, as it is much simpler to implement and use.
Pollsockets uses a simple polling mechanism to send events from the server to the client. Instead of polling an endpoint that returns data, pollsockets polls an endpoint that returns a list of events that have occurred, thus saving bandwidth and response time. The client then processes the events and updates the UI accordingly.
- PHP 8.1 or higher
- Laravel 9.0 or higher
- Redis 6.0 or higher
You can install the package via composer:
composer require pollsockets/pollsockets-laravel
You can publish the config file with:
php artisan vendor:publish --tag="pollsockets-config"
This is the contents of the published config file:
use Pollsockets\Drivers\RedisChannel;
return [
'driver' => RedisChannel::class,
];
use Pollsockets\Pollsockets;
// Channel name can be any string. Can be used to separate events from different sources.
$channelName = 'channel';
// Event name can be any string. Can be used to separate events of the same type.
$event = 'reload';
// Publish an event to the channel from anywhere in your code. Perfect for informing client about changes in the database.
Pollsockets::channel($channelName)->publish($event);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.