Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Protocol::WebSocket::HUserhContributedrPeocol::WebSocket::Handshake::Server(3)

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

SYNOPSIS
	   my $h = Protocol::WebSocket::Handshake::Server->new;

	   # Parse client request
	   $h->parse(<<"EOF");
	       WebSocket HTTP message
	   EOF

	   $h->error;	# Check	if there were any errors
	   $h->is_done;	# Returns 1

	   # Create response
	   $h->to_string;

DESCRIPTION
       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.

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

   "new_from_psgi"
	   my $env = {
	       HTTP_HOST => 'example.com',
	       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"
	   $handshake->parse($buffer);
	   $handshake->parse($handle);

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

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

   "build_frame"
	   $handshake->build_frame;

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

   "to_string"
       Construct a WebSocket server response.

   "is_body"
       Check whether handshake is in body state.

   "is_done"
       Check whether handshake is done.

perl v5.32.0			  201Protocol::WebSocket::Handshake::Server(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Protocol::WebSocket::Handshake::Server&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help