GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Protocol::WebSocket::Response(3) User Contributed Perl Documentation Protocol::WebSocket::Response(3)

Protocol::WebSocket::Response - WebSocket Response

    # Constructor
    $res = Protocol::WebSocket::Response->new(
        host          => 'example.com',
        resource_name => '/demo',
        origin        => 'file://',
        number1       => 777_007_543,
        number2       => 114_997_259,
        challenge     => "\x47\x30\x22\x2D\x5A\x3F\x47\x58"
    );
    $res->to_string; # HTTP/1.1 101 WebSocket Protocol Handshake
                     # Upgrade: WebSocket
                     # Connection: Upgrade
                     # Sec-WebSocket-Origin: file://
                     # Sec-WebSocket-Location: ws://example.com/demo
                     #
                     # 0st3Rl&q-2ZU^weu

    # Parser
    $res = Protocol::WebSocket::Response->new;
    $res->parse("HTTP/1.1 101 WebSocket Protocol Handshake\x0d\x0a");
    $res->parse("Upgrade: WebSocket\x0d\x0a");
    $res->parse("Connection: Upgrade\x0d\x0a");
    $res->parse("Sec-WebSocket-Origin: file://\x0d\x0a");
    $res->parse("Sec-WebSocket-Location: ws://example.com/demo\x0d\x0a");
    $res->parse("\x0d\x0a");
    $res->parse("0st3Rl&q-2ZU^weu");

Construct or parse a WebSocket response.

Create a new Protocol::WebSocket::Response instance.

    $res->parse($buffer);

Parse a WebSocket response. Incoming buffer is modified.

Construct a WebSocket response.

    $self->key1;

Set or get "Sec-WebSocket-Key1" field.

    $self->key2;

Set or get "Sec-WebSocket-Key2" field.

    $self->number1;
    $self->number1(123456);

Set or extract from "Sec-WebSocket-Key1" generated "number" value.

    $self->number2;
    $self->number2(123456);

Set or extract from "Sec-WebSocket-Key2" generated "number" value.

    $self->status;

Get response status (101).

    $self->body;

Get response body.

    my $arrayref = $self->headers;

Get response headers.

2017-12-12 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.