Scroll to navigation

Protocol::WebSocket::Handshake::Server(3pm) User Contributed Perl Documentation Protocol::WebSocket::Handshake::Server(3pm)


Protocol::WebSocket::Handshake::Server - WebSocket Server Handshake


    my $h = Protocol::WebSocket::Handshake::Server->new;
    # Parse client request
        WebSocket HTTP message
    $h->error;   # Check if there were any errors
    $h->is_done; # Returns 1
    # Create response


Construct or parse a server WebSocket handshake. This module is written for convenience, since using request and response directly requires the same code again and again.



Create a new Protocol::WebSocket::Handshake::Server instance.


    my $env = {
        HTTP_HOST => '',
        HTTP_CONNECTION => 'Upgrade',
    my $handshake = Protocol::WebSocket::Handshake::Server->new_from_psgi($env);

Create a new Protocol::WebSocket::Handshake::Server instance from PSGI environment.



Parse a WebSocket client request. Returns "undef" and sets "error" attribute on error.

When buffer is passed it's modified (unless readonly).



Builds Protocol::WebSocket::Frame with an appropriate version.


Construct a WebSocket server response.


Check whether handshake is in body state.


Check whether handshake is done.

2019-03-13 perl v5.38.2