Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling disconnect on a Centrifugo request throws exception #100

Open
arizanovj opened this issue Feb 1, 2024 · 3 comments
Open

Calling disconnect on a Centrifugo request throws exception #100

arizanovj opened this issue Feb 1, 2024 · 3 comments

Comments

@arizanovj
Copy link

Description

There is no possibility to open issues on the related repo, so I'm doing it here instead.

When I try to call disconnect in my Auth interceptor for proxied centrifugo connections an error is thrown because of a missing field in one of the DTOs.

Exception & stacktrace:

{
    "exception": {
      "error": "[Exception] No such field reconnect as /vendor/roadrunner-php/roadrunner-api-dto/generated/RoadRunner/Centrifugal/Proxy/DTO/V1/Disconnect.php:37",
      "stacktrace": [
        {
          "function": "Google\\Protobuf\\Internal\\Message->__construct()"
        },
        {
          "function": "RoadRunner\\Centrifugal\\Proxy\\DTO\\V1\\Disconnect->__construct()"
        },
        {
          "function": "RoadRunner\\Centrifugo\\Request\\AbstractRequest->disconnect()"
        },
        ]
   }
}

How To Reproduce

Call disconnect on a request coming from Centrifugo - RequestInterface.
The code fails here: https://github.com/roadrunner-php/centrifugo/blob/2.x/src/Request/AbstractRequest.php#L67 because the Disconnect DTO is missing the reconnect field.

Additional Info

Q A
Package Version latest
PHP version 8.3.2
Operating system Linux
@FZambia
Copy link

FZambia commented Feb 1, 2024

Reconnect flag was removed in Centrifugo v5

Also, from Centrifugo docs:

Application must use numbers in the range 4000-4999 for custom disconnect codes:
codes in range [4000, 4499] give client an advice to reconnect
codes in range [4500, 4999] are terminal codes – client won't reconnect upon receiving it.

@arizanovj
Copy link
Author

It seems the DTOs in the linked repo were generated from newer (Centrifugo v5) protobuf files and the disconnect function still has the reconnect flag. Needs to be removed in order to support Centrifugo v5.

@arizanovj
Copy link
Author

@butschster any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants