定制 pollsockets/pollsockets-laravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pollsockets/pollsockets-laravel

最新稳定版本:1.3.0

Composer 安装命令:

composer require pollsockets/pollsockets-laravel

包简介

Serverside implementation of pollsockets taylored for Laravel

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Why pollsockets?

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.

How does it work?

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.

Ecosystem

Server side

Client side

Requirements

  • PHP 8.1 or higher
  • Laravel 9.0 or higher
  • Redis 6.0 or higher

Installation

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,
];

Usage

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);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 59
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-31