push插件在uniapp中使用问题

皮皮侠

问题描述

订阅频道是要和链接写在一块才能正确订阅,我将链接对象保存到全局变量中在其他地方调用订阅无法成功

为此你搜索到了哪些方案及不适用的原因

如下图写在一块频道可以订阅成功
截图
但是分开写后无法成功订阅频道
比如在onLaunch仅链接

that.globalData.connection = new Push({
    url: WEBSOCKET_URL, // websocket地址
    app_key: APP_KEY,
    auth: '/plugin/webman/push/auth' // 订阅鉴权(仅限于私有频道)
});

然后在其他页面onShow中订阅

var user_channel = that.globalData.connection.subscribe('user-chat-' + uid);
composer show
[root@VM-0-15-centos chat.sdwanyue.com]# composer show
Warning: This development build of Composer is over 60 days old. It is recommended to update it by running "/usr/bin/composer self-update" to get the latest version.
brick/math                              0.11.0  Arbitrary-precision arithmetic library
doctrine/inflector                      2.0.6   PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
easywechat-composer/easywechat-composer 1.4.1   The composer plugin for EasyWeChat
guzzlehttp/guzzle                       7.5.1   Guzzle is a PHP HTTP client library
guzzlehttp/promises                     1.5.2   Guzzle promises library
guzzlehttp/psr7                         2.5.0   PSR-7 message implementation that also provides common utility methods
illuminate/bus                          v10.9.0 The Illuminate Bus package.
illuminate/collections                  v10.9.0 The Illuminate Collections package.
illuminate/conditionable                v10.9.0 The Illuminate Conditionable package.
illuminate/container                    v10.9.0 The Illuminate Container package.
illuminate/contracts                    v10.9.0 The Illuminate Contracts package.
illuminate/database                     v10.9.0 The Illuminate Database package.
illuminate/events                       v10.9.0 The Illuminate Events package.
illuminate/macroable                    v10.9.0 The Illuminate Macroable package.
illuminate/pagination                   v10.9.0 The Illuminate Pagination package.
illuminate/pipeline                     v10.9.0 The Illuminate Pipeline package.
illuminate/redis                        v10.9.0 The Illuminate Redis package.
illuminate/support                      v10.9.0 The Illuminate Support package.
intervention/image                      2.7.2   Image handling and manipulation library with support for Laravel integration
monolog/monolog                         2.9.1   Sends your logs to files, sockets, inboxes, databases and various web services
nesbot/carbon                           2.66.0  An API extension for DateTime that supports 281 different languages.
nikic/fast-route                        v1.3.0  Fast request router for PHP
overtrue/easy-sms                       2.4.2   The easiest way to send short message.
overtrue/socialite                      4.8.0   A collection of OAuth 2 packages.
pimple/pimple                           v3.5.0  Pimple, a simple Dependency Injection Container
psr/cache                               3.0.0   Common interface for caching libraries
psr/container                           2.0.2   Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                    1.0.0   Standard interfaces for event handling.
psr/http-client                         1.0.2   Common interface for HTTP clients
psr/http-factory                        1.0.2   Common interfaces for PSR-7 HTTP message factories
psr/http-message                        2.0     Common interface for HTTP messages
psr/log                                 3.0.0   Common interface for logging libraries
psr/simple-cache                        3.0.0   Common interfaces for simple caching
ralouphie/getallheaders                 3.0.3   A polyfill for getallheaders.
symfony/cache                           v6.2.10 Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts                 v3.2.1  Generic abstractions related to caching
symfony/deprecation-contracts           v3.2.1  A generic function and convention to trigger deprecation notices
symfony/event-dispatcher                v6.2.8  Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts      v3.2.1  Generic abstractions related to dispatching event
symfony/http-foundation                 v6.2.10 Defines an object-oriented layer for the HTTP specification
symfony/polyfill-mbstring               v1.27.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php80                  v1.27.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/psr-http-message-bridge         v2.2.0  PSR HTTP message bridge
symfony/service-contracts               v3.2.1  Generic abstractions related to writing services
symfony/translation                     v6.2.8  Provides tools to internationalize your application
symfony/translation-contracts           v3.2.1  Generic abstractions related to translation
symfony/var-exporter                    v6.2.10 Allows exporting any serializable PHP data structure to plain PHP code
voku/portable-ascii                     2.0.1   Portable ASCII library - performance optimized (ascii) string functions for php.
w7corp/easywechat                       5.33.0  微信SDK
webman/admin                            v0.6.7  Webman Admin
webman/captcha                          v1.0.2  Captcha generator
webman/event                            v1.0.4  Webman event plugin
webman/push                             v1.0.12
workerman/webman-framework              v1.5.5  High performance HTTP Service Framework.
workerman/workerman                     v4.1.10 An asynchronous event driven PHP framework for easily building fast, scalable network applications
1054 1 0
1个回答

walkor 打赏

升级webman/push

  • 皮皮侠 2023-07-03

    感谢老大 只更新的webman/push还是不行 把客户端push-uniapp.js一块更新可以了

年代过于久远,无法发表回答
×
🔝