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

feature: support permessage connection in websocket #157

Open
sc0Vu opened this issue Oct 6, 2024 · 0 comments
Open

feature: support permessage connection in websocket #157

sc0Vu opened this issue Oct 6, 2024 · 0 comments

Comments

@sc0Vu
Copy link

sc0Vu commented Oct 6, 2024

Hi there,

Thanks for this great library. Recently, I’ve been trying to connect to the server with permessage-deflate. While the connection was established, the message wasn’t compressed, which led to a frame error. I tried encoding the message myself, but it didn’t work because the frame wasn’t correct. I noticed there is a deflateFrame method in MessageBuffer, and I believe it can support permessage-deflate in WebSocket.

In my opinion, the permessage-deflate can be added when initializing the stream (https://github.com/ratchetphp/Pawl/blob/master/src/WebSocket.php#L69).

Let me know if you have any suggestions.

        $permessageDeflateOptions = PermessageDeflateOptions::fromRequestOrResponse($request);
        $sender = null;
        $permessageDeflateOption = null;
        if (count($permessageDeflateOptions) > 1) {
            $sender = [$stream, 'write'];
            $permessageDeflateOption = $permessageDeflateOptions[0];
        }
        $streamer = new MessageBuffer(
            ......
            null,
            null
            $sender,
            $permessageDeflateOption
        );
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

1 participant