Update websocket module & example

This commit is contained in:
Alexander Pankratov 2022-06-05 01:21:08 +03:00
parent f76913409d
commit bbfa7f07f0
4 changed files with 176 additions and 91 deletions

223
composer.lock generated
View File

@ -2353,12 +2353,12 @@
"source": {
"type": "git",
"url": "https://github.com/danog/MadelineProto.git",
"reference": "1f55447a3ab19db44acce441685e31789de5ca6b"
"reference": "725f75e1506d57dde94f00b91b22bd6693d69755"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/danog/MadelineProto/zipball/1f55447a3ab19db44acce441685e31789de5ca6b",
"reference": "1f55447a3ab19db44acce441685e31789de5ca6b",
"url": "https://api.github.com/repos/danog/MadelineProto/zipball/725f75e1506d57dde94f00b91b22bd6693d69755",
"reference": "725f75e1506d57dde94f00b91b22bd6693d69755",
"shasum": ""
},
"require": {
@ -2395,7 +2395,8 @@
"psr/http-factory": "^1.0",
"psr/log": "^1",
"symfony/polyfill-mbstring": "*",
"symfony/polyfill-php80": "^1.18"
"symfony/polyfill-php80": "^1.18",
"webmozart/assert": "^1.10"
},
"conflict": {
"ext-pthreads": "*",
@ -2412,11 +2413,11 @@
"symfony/yaml": "^6.0"
},
"suggest": {
"ext-ffi": "Install the primemodule and FFI extensions to speed up MadelineProto (https://prime.madelineproto.xyz)",
"ext-gmp": "Install the gmp extension for faster crypto",
"ext-libtgvoip": "Install the php-libtgvoip extension to make phone calls (https://github.com/danog/php-libtgvoip)",
"ext-openssl": "Install the openssl extension for faster crypto",
"ext-pdo": "Install pdo extension to support database used as cache",
"ext-primemodule": "Install the primemodule FFI extension to make phone calls (https://prime.madelineproto.xyz)"
"ext-primemodule": "Install the primemodule and FFI extensions to speed up MadelineProto (https://prime.madelineproto.xyz)"
},
"default-branch": true,
"type": "project",
@ -2428,7 +2429,6 @@
"autoload": {
"files": [
"src/BigIntegor.php",
"src/YieldReturnValue.php",
"src/polyfill.php"
],
"psr-4": {
@ -2463,7 +2463,7 @@
],
"support": {
"issues": "https://github.com/danog/MadelineProto/issues",
"source": "https://github.com/danog/MadelineProto/tree/stable"
"source": "https://github.com/danog/MadelineProto/tree/7.0.91.9999"
},
"funding": [
{
@ -2471,7 +2471,7 @@
"type": "github"
}
],
"time": "2022-05-15T20:29:55+00:00"
"time": "2022-06-04T19:23:34+00:00"
},
{
"name": "danog/magicalserializer",
@ -2520,25 +2520,33 @@
},
{
"name": "danog/primemodule",
"version": "1.0.7",
"version": "1.0.10.9999",
"source": {
"type": "git",
"url": "https://github.com/danog/PrimeModule.git",
"reference": "371cf2521dc665875cac5765259240c0666de69c"
"reference": "dadd3fa2693425f2b7feee5bb717d79b1af42b80"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/danog/PrimeModule/zipball/371cf2521dc665875cac5765259240c0666de69c",
"reference": "371cf2521dc665875cac5765259240c0666de69c",
"url": "https://api.github.com/repos/danog/PrimeModule/zipball/dadd3fa2693425f2b7feee5bb717d79b1af42b80",
"reference": "dadd3fa2693425f2b7feee5bb717d79b1af42b80",
"shasum": ""
},
"require": {
"php": ">=7.0"
"php": "^8.0"
},
"require-dev": {
"phabel/phabel": "^1"
},
"suggest": {
"ext-primemodule": "Install the native C++ extension for extremely fast factorization (https://github.com/danog/PrimeModule-ext)"
"ext-primemodule": "Install the native C++ extension for extremely fast factorization (https://prime.madelineproto.xyz)"
},
"type": "library",
"extra": {
"phabel": {
"revision": 0
}
},
"autoload": {
"psr-0": {
"danog\\": "lib/"
@ -2557,9 +2565,9 @@
"description": "Prime module capable of doing prime factorization of huge numbers very quickly.\"",
"support": {
"issues": "https://github.com/danog/PrimeModule/issues",
"source": "https://github.com/danog/PrimeModule/tree/1.0.7"
"source": "https://github.com/danog/PrimeModule/tree/1.0.10.9999"
},
"time": "2021-10-24T16:51:03+00:00"
"time": "2022-05-22T12:28:02+00:00"
},
{
"name": "danog/tg-file-decoder",
@ -2773,33 +2781,35 @@
},
{
"name": "league/uri",
"version": "6.5.0",
"version": "6.6.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri.git",
"reference": "c68ca445abb04817d740ddd6d0b3551826ef0c5a"
"reference": "4147f19b9de3b5af6a258f35d7a0efbbf9963298"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri/zipball/c68ca445abb04817d740ddd6d0b3551826ef0c5a",
"reference": "c68ca445abb04817d740ddd6d0b3551826ef0c5a",
"url": "https://api.github.com/repos/thephpleague/uri/zipball/4147f19b9de3b5af6a258f35d7a0efbbf9963298",
"reference": "4147f19b9de3b5af6a258f35d7a0efbbf9963298",
"shasum": ""
},
"require": {
"ext-json": "*",
"league/uri-interfaces": "^2.3",
"php": "^7.3 || ^8.0",
"php": "^7.4 || ^8.0",
"psr/http-message": "^1.0"
},
"conflict": {
"league/uri-schemes": "^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19 || ^3.0",
"phpstan/phpstan": "^0.12.90",
"phpstan/phpstan-phpunit": "^0.12.22",
"phpstan/phpstan-strict-rules": "^0.12.11",
"phpunit/phpunit": "^8.0 || ^9.0",
"friendsofphp/php-cs-fixer": "^v3.3.2",
"php-http/psr7-integration-tests": "^1.1",
"phpstan/phpstan": "^1.2.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.1.0",
"phpunit/phpunit": "^9.5.10",
"psr/http-factory": "^1.0"
},
"suggest": {
@ -2831,7 +2841,7 @@
}
],
"description": "URI manipulation library",
"homepage": "http://uri.thephpleague.com",
"homepage": "https://uri.thephpleague.com",
"keywords": [
"data-uri",
"file-uri",
@ -2857,7 +2867,7 @@
"docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri/issues",
"source": "https://github.com/thephpleague/uri/tree/6.5.0"
"source": "https://github.com/thephpleague/uri/tree/6.6.0"
},
"funding": [
{
@ -2865,7 +2875,7 @@
"type": "github"
}
],
"time": "2021-08-27T09:54:07+00:00"
"time": "2022-05-28T05:44:35+00:00"
},
{
"name": "league/uri-interfaces",
@ -3618,16 +3628,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "30885182c981ab175d4d034db0f6f469898070ab"
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
"reference": "30885182c981ab175d4d034db0f6f469898070ab",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
"shasum": ""
},
"require": {
@ -3642,7 +3652,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -3680,7 +3690,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0"
},
"funding": [
{
@ -3696,20 +3706,20 @@
"type": "tidelift"
}
],
"time": "2021-10-20T20:35:02+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
"shasum": ""
},
"require": {
@ -3724,7 +3734,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -3763,7 +3773,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0"
},
"funding": [
{
@ -3779,20 +3789,20 @@
"type": "tidelift"
}
],
"time": "2021-11-30T18:21:41+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c"
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"shasum": ""
},
"require": {
@ -3801,7 +3811,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -3846,7 +3856,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
},
"funding": [
{
@ -3862,7 +3872,7 @@
"type": "tidelift"
}
],
"time": "2022-03-04T08:16:47+00:00"
"time": "2022-05-10T07:21:04+00:00"
},
{
"name": "vlucas/phpdotenv",
@ -3941,6 +3951,64 @@
}
],
"time": "2021-12-12T23:07:53+00:00"
},
{
"name": "webmozart/assert",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": "^7.2 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<4.6.1 || 4.6.2"
},
"require-dev": {
"phpunit/phpunit": "^8.5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
},
"time": "2022-06-03T18:03:27+00:00"
}
],
"packages-dev": [
@ -3950,12 +4018,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "2ed308386e65cafaadd54723f5b57775374c2ae8"
"reference": "e44f8ca7996a2573a10b7f1f8baff9c9caf7db09"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/2ed308386e65cafaadd54723f5b57775374c2ae8",
"reference": "2ed308386e65cafaadd54723f5b57775374c2ae8",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e44f8ca7996a2573a10b7f1f8baff9c9caf7db09",
"reference": "e44f8ca7996a2573a10b7f1f8baff9c9caf7db09",
"shasum": ""
},
"conflict": {
@ -3963,7 +4031,7 @@
"admidio/admidio": "<4.1.9",
"adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3",
"akaunting/akaunting": "<2.1.13",
"alextselegidis/easyappointments": "<1.4.3",
"alextselegidis/easyappointments": "<=1.4.3",
"alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1",
"amazing/media2click": ">=1,<1.3.3",
"amphp/artax": "<1.0.6|>=2,<2.0.6",
@ -3988,6 +4056,7 @@
"bolt/core": "<=4.2",
"bottelet/flarepoint": "<2.2.1",
"brightlocal/phpwhois": "<=4.2.5",
"brotkrueml/codehighlight": "<2.7",
"buddypress/buddypress": "<7.2.1",
"bugsnag/bugsnag-laravel": ">=2,<2.0.2",
"bytefury/crater": "<6.0.2",
@ -4012,7 +4081,7 @@
"contao/core-bundle": "<4.9.18|>=4.10,<4.11.7|>=4.13,<4.13.3|= 4.10.0",
"contao/listing-bundle": ">=4,<4.4.8",
"contao/managed-edition": "<=1.5",
"craftcms/cms": "<3.7.29",
"craftcms/cms": "<3.7.36",
"croogo/croogo": "<3.0.7",
"cuyz/valinor": ">=0.5,<0.7",
"czproject/git-php": "<4.0.3",
@ -4049,25 +4118,27 @@
"ezsystems/ezplatform": "<=1.13.6|>=2,<=2.5.24",
"ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<1.5.27",
"ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1",
"ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<1.3.17",
"ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<1.3.19",
"ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<1.3.8",
"ezsystems/ezplatform-richtext": ">=2.3,<=2.3.7",
"ezsystems/ezplatform-user": ">=1,<1.0.1",
"ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<7.5.28",
"ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<7.5.29",
"ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.3.5.1",
"ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3",
"ezsystems/repository-forms": ">=2.3,<2.3.2.1",
"ezyang/htmlpurifier": "<4.1.1",
"facade/ignition": "<1.16.15|>=2,<2.4.2|>=2.5,<2.5.2",
"facturascripts/facturascripts": "<2022.6",
"facturascripts/facturascripts": "<2022.8",
"feehi/cms": "<=2.1.1",
"feehi/feehicms": "<=0.1.3",
"fenom/fenom": "<=2.12.1",
"filegator/filegator": "<7.8",
"firebase/php-jwt": "<2",
"flarum/core": ">=1,<=1.0.1",
"flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15",
"flarum/tags": "<=0.1-beta.13",
"fluidtypo3/vhs": "<5.1.1",
"fof/upload": "<1.2.3",
"fooman/tcpdf": "<6.2.22",
"forkcms/forkcms": "<5.11.1",
"fossar/tcpdf-parser": "<6.2.22",
@ -4081,7 +4152,7 @@
"fuel/core": "<1.8.1",
"gaoming13/wechat-php-sdk": "<=1.10.2",
"genix/cms": "<=1.1.11",
"getgrav/grav": "<1.7.31",
"getgrav/grav": "<1.7.33",
"getkirby/cms": "<3.5.8",
"getkirby/panel": "<2.5.14",
"gilacms/gila": "<=1.11.4",
@ -4091,14 +4162,14 @@
"gree/jose": "<=2.2",
"gregwar/rst": "<1.0.3",
"grumpydictator/firefly-iii": "<5.6.5",
"guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1",
"guzzlehttp/guzzle": "<6.5.6|>=7,<7.4.3",
"guzzlehttp/psr7": "<1.8.4|>=2,<2.1.1",
"helloxz/imgurl": "<=2.31",
"helloxz/imgurl": "= 2.31|<=2.31",
"hillelcoren/invoice-ninja": "<5.3.35",
"hjue/justwriting": "<=1",
"hov/jobfair": "<1.0.13|>=2,<2.0.2",
"hyn/multi-tenant": ">=5.6,<5.7.2",
"ibexa/core": ">=4,<4.0.5|>=4.1,<4.1.2",
"ibexa/core": ">=4,<4.0.7|>=4.1,<4.1.4",
"ibexa/post-install": "<=1.0.4",
"icecoder/icecoder": "<=8.1",
"illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10",
@ -4137,7 +4208,7 @@
"league/commonmark": "<0.18.3",
"league/flysystem": "<1.1.4|>=2,<2.1.1",
"lexik/jwt-authentication-bundle": "<2.10.7|>=2.11,<2.11.3",
"librenms/librenms": "<22.2.2",
"librenms/librenms": "<22.4",
"limesurvey/limesurvey": "<3.27.19",
"livehelperchat/livehelperchat": "<=3.91",
"livewire/livewire": ">2.2.4,<2.2.6",
@ -4150,21 +4221,22 @@
"magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2",
"marcwillmann/turn": "<0.3.3",
"matyhtf/framework": "<3.0.6",
"mautic/core": "<4.2|= 2.13.1",
"mautic/core": "<4.3|= 2.13.1",
"mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35",
"microweber/microweber": "<1.3",
"miniorange/miniorange-saml": "<1.4.3",
"mittwald/typo3_forum": "<1.2.1",
"modx/revolution": "<= 2.8.3-pl|<2.8",
"mojo42/jirafeau": "<4.4",
"monolog/monolog": ">=1.8,<1.12",
"moodle/moodle": "<3.9.13|>=3.10-beta,<3.10.10|>=3.11,<3.11.6",
"moodle/moodle": "<4.0.1",
"mustache/mustache": ">=2,<2.14.1",
"namshi/jose": "<2.2",
"neoan3-apps/template": "<1.1.1",
"neorazorx/facturascripts": "<2022.4",
"neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6",
"neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3",
"neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3",
"neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2",
"neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5",
"netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15",
"nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6",
@ -4212,7 +4284,7 @@
"pimcore/data-hub": "<1.2.4",
"pimcore/pimcore": "<10.4",
"pocketmine/bedrock-protocol": "<8.0.2",
"pocketmine/pocketmine-mp": "<4.2.9",
"pocketmine/pocketmine-mp": "<4.2.10",
"pressbooks/pressbooks": "<5.18",
"prestashop/autoupgrade": ">=4,<4.10.1",
"prestashop/contactform": ">1.0.1,<4.3",
@ -4234,7 +4306,8 @@
"rmccue/requests": ">=1.6,<1.8",
"robrichards/xmlseclibs": "<3.0.4",
"rudloff/alltube": "<3.0.3",
"s-cart/s-cart": "<6.7.2",
"s-cart/core": "<6.9",
"s-cart/s-cart": "<6.9",
"sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1",
"sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9",
"scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11",
@ -4245,6 +4318,7 @@
"shopware/production": "<=6.3.5.2",
"shopware/shopware": "<5.7.9",
"shopware/storefront": "<=6.4.8.1",
"shopxo/shopxo": "<2.2.6",
"showdoc/showdoc": "<2.10.4",
"silverstripe/admin": ">=1,<1.8.1",
"silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2",
@ -4264,8 +4338,8 @@
"simplesamlphp/simplesamlphp-module-infocard": "<1.0.1",
"simplito/elliptic-php": "<1.0.6",
"slim/slim": "<2.6",
"smarty/smarty": "<3.1.43|>=4,<4.0.3",
"snipe/snipe-it": "<5.4.3|>= 6.0.0-RC-1, <= 6.0.0-RC-5",
"smarty/smarty": "<3.1.45|>=4,<4.1.1",
"snipe/snipe-it": "<5.4.4|>= 6.0.0-RC-1, <= 6.0.0-RC-5",
"socalnick/scn-social-auth": "<1.15.2",
"socialiteproviders/steam": "<1.1",
"spipu/html2pdf": "<5.2.4",
@ -4326,7 +4400,7 @@
"theonedemon/phpwhois": "<=4.2.5",
"tinymce/tinymce": "<5.10",
"titon/framework": ">=0,<9.9.99",
"topthink/framework": "<6.0.9",
"topthink/framework": "<6.0.12",
"topthink/think": "<=6.0.9",
"topthink/thinkphp": "<=3.2.3",
"tribalsystems/zenario": "<9.2.55826",
@ -4355,10 +4429,11 @@
"wikimedia/parsoid": "<0.12.2",
"willdurand/js-translation-bundle": "<2.1.1",
"wp-cli/wp-cli": "<2.5",
"wp-graphql/wp-graphql": "<0.3.5",
"wpanel/wpanel4-cms": "<=4.3.1",
"wwbn/avideo": "<=11.6",
"yeswiki/yeswiki": "<4.1",
"yetiforce/yetiforce-crm": "<=6.3",
"yetiforce/yetiforce-crm": "<6.4",
"yidashi/yii2cmf": "<=2",
"yii2mod/yii2-cms": "<1.9.2",
"yiisoft/yii": ">=1.1.14,<1.1.15",
@ -4431,7 +4506,7 @@
"type": "tidelift"
}
],
"time": "2022-05-11T11:06:18+00:00"
"time": "2022-06-03T23:04:18+00:00"
}
],
"aliases": [],

View File

@ -7,6 +7,7 @@
require 'vendor/autoload.php';
use Amp\Loop;
use Amp\Websocket\Client\Connection;
use Amp\Websocket\Message;
use function Amp\Websocket\Client\connect;
@ -20,15 +21,22 @@ $options = [
'url' => $options['url'] ?? $options['u'] ?? 'ws://127.0.0.1:9503/events',
];
Amp\Loop::run(static function () use($options) {
Amp\Loop::run(static function () use ($options) {
echo "Connecting to: {$options['url']}" . PHP_EOL;
while(true) {
while (true) {
try {
/** @var Connection $connection */
$connection = yield connect($options['url']);
$connection->onClose(static function() use($connection) {
$repeat = Loop::repeat(5_000, function () use ($connection) {
echo 'ping' . PHP_EOL;
yield $connection->send('ping');
});
$connection->onClose(static function () use ($connection, &$repeat) {
Loop::cancel($repeat);
$repeat = null;
printf("Connection closed. Reason: %s\n", $connection->getCloseReason());
});
@ -36,9 +44,12 @@ Amp\Loop::run(static function () use($options) {
while ($message = yield $connection->receive()) {
/** @var Message $message */
$payload = yield $message->buffer();
printf("Received event: %s\n", $payload);
printf("[%s] Received event: %s\n", date('Y-m-d H:i:s'), $payload);
}
} catch (\Throwable $e) {
if (!empty($repeat)) {
Loop::cancel($repeat);
}
printf("Error: %s\n", $e->getMessage());
}
yield new Amp\Delayed(500);

View File

@ -10,7 +10,7 @@ use Amp\Promise;
use Amp\Success;
use Amp\Websocket\Client as WebsocketClient;
use Amp\Websocket\Server\ClientHandler;
use Amp\Websocket\Server\Endpoint;
use Amp\Websocket\Server\Gateway;
use Amp\Websocket\Server\Websocket as WebsocketServer;
use TelegramApiServer\Client;
use TelegramApiServer\EventObservers\EventObserver;
@ -22,10 +22,10 @@ class EventsController implements ClientHandler
public static function getRouterCallback(): WebsocketServer
{
$class = new static();
return new WebsocketServer($class);
return new WebsocketServer($class);
}
public function handleHandshake(Endpoint $endpoint, Request $request, Response $response): Promise
public function handleHandshake(Gateway $gateway, Request $request, Response $response): Promise
{
try {
$session = $request->getAttribute(Router::class)['session'] ?? null;
@ -35,17 +35,17 @@ class EventsController implements ClientHandler
throw new \RuntimeException('No sessions available');
}
} catch (\Throwable $e){
return $endpoint->getErrorHandler()->handleError(Status::NOT_FOUND, $e->getMessage());
return $gateway->getErrorHandler()->handleError(Status::NOT_FOUND, $e->getMessage());
}
return new Success($response);
}
public function handleClient(Endpoint $endpoint, WebsocketClient $client, Request $request, Response $response): Promise
public function handleClient(Gateway $gateway, WebsocketClient $client, Request $request, Response $response): Promise
{
return call(static function() use($endpoint, $client, $request) {
return call(static function() use($gateway, $client, $request) {
$requestedSession = $request->getAttribute(Router::class)['session'] ?? null;
yield from static::subscribeForUpdates($endpoint, $client, $requestedSession);
yield from static::subscribeForUpdates($gateway, $client, $requestedSession);
while ($message = yield $client->receive()) {
// Messages received on the connection are ignored and discarded.
@ -54,7 +54,7 @@ class EventsController implements ClientHandler
});
}
private static function subscribeForUpdates(Endpoint $endpoint, WebsocketClient $client, ?string $requestedSession): \Generator
private static function subscribeForUpdates(Gateway $gateway, WebsocketClient $client, ?string $requestedSession): \Generator
{
$clientId = $client->getId();
@ -65,7 +65,7 @@ class EventsController implements ClientHandler
EventObserver::stopEventHandler($requestedSession);
});
EventObserver::addSubscriber($clientId, static function($update, ?string $session) use($endpoint, $clientId, $requestedSession) {
EventObserver::addSubscriber($clientId, static function($update, ?string $session) use($gateway, $clientId, $requestedSession) {
if ($requestedSession && $session !== $requestedSession) {
return;
}
@ -78,7 +78,7 @@ class EventsController implements ClientHandler
'id' => null,
];
$endpoint->multicast(
$gateway->multicast(
json_encode(
$update,
JSON_THROW_ON_ERROR |

View File

@ -10,12 +10,11 @@ class EventHandler extends \danog\MadelineProto\EventHandler
public static array $instances = [];
private string $sessionName;
public function __construct(APIWrapper $MadelineProto)
public function onStart()
{
$this->sessionName = Files::getSessionName($MadelineProto->session);
$this->sessionName = Files::getSessionName($this->API->wrapper->session);
if (empty(static::$instances[$this->sessionName])) {
static::$instances[$this->sessionName] = true;
parent::initInternal($MadelineProto);
warning("Event observer CONSTRUCTED: {$this->sessionName}");
}
}