1Protocol::WebSocket::HaUnsdesrhaCkoen:t:rSiebruvtPeerrdo(t3Popecmro)ll:D:oWceubmSeonctkaetti:o:nHandshake::Server(3pm)
2
3
4
6 Protocol::WebSocket::Handshake::Server - WebSocket Server Handshake
7
9 my $h = Protocol::WebSocket::Handshake::Server->new;
10
11 # Parse client request
12 $h->parse(<<"EOF");
13 WebSocket HTTP message
14 EOF
15
16 $h->error; # Check if there were any errors
17 $h->is_done; # Returns 1
18
19 # Create response
20 $h->to_string;
21
23 Construct or parse a server WebSocket handshake. This module is written
24 for convenience, since using request and response directly requires the
25 same code again and again.
26
28 "new"
29 Create a new Protocol::WebSocket::Handshake::Server instance.
30
31 "new_from_psgi"
32 my $env = {
33 HTTP_HOST => 'example.com',
34 HTTP_CONNECTION => 'Upgrade',
35 ...
36 };
37 my $handshake = Protocol::WebSocket::Handshake::Server->new_from_psgi($env);
38
39 Create a new Protocol::WebSocket::Handshake::Server instance from PSGI
40 environment.
41
42 "parse"
43 $handshake->parse($buffer);
44 $handshake->parse($handle);
45
46 Parse a WebSocket client request. Returns "undef" and sets "error"
47 attribute on error.
48
49 When buffer is passed it's modified (unless readonly).
50
51 "build_frame"
52 $handshake->build_frame;
53
54 Builds Protocol::WebSocket::Frame with an appropriate version.
55
56 "to_string"
57 Construct a WebSocket server response.
58
59 "is_body"
60 Check whether handshake is in body state.
61
62 "is_done"
63 Check whether handshake is done.
64
65
66
67perl v5.36.0 20P2r2o-t0o7c-o2l2::WebSocket::Handshake::Server(3pm)