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


Manual Reference Pages  -  PROTOCOL::WEBSOCKET (3)

.ds Aq ’

NAME

Protocol::WebSocket - WebSocket protocol

CONTENTS

SYNOPSIS



    # Server side
    my $hs = Protocol::WebSocket::Handshake::Server->new;

    $hs->parse(some data from the client);

    $hs->is_done; # tells us when handshake is done

    # Passing version is important for backwards compatibility
    my $frame = Protocol::WebSocket::Frame->new(version => $hs->version);

    $frame->append(some data from the client);

    while (defined(my $message = $frame->next)) {
        if ($frame->is_close) {

            # Send close frame back
            send(
                Protocol::WebSocket::Frame->new(
                    type    => close,
                    version => $version
                )
            );

            return;
        }

        # We got a message!
    }



DESCRIPTION

Client/server WebSocket message and frame parser/constructor. This module does not provide a WebSocket server or client, but is made for using in http servers or clients to provide WebSocket support.

Protocol::WebSocket supports the following WebSocket protocol versions:



    draft-ietf-hybi-17 (latest)
    draft-ietf-hybi-10
    draft-ietf-hybi-00
    draft-hixie-75



By default the latest version is used. The WebSocket version is detected automatically on the server side. On the client side you have set a version attribute to an appropriate value.

Protocol::WebSocket itself does not contain any code and cannot be used directly. Instead the following modules should be used:

    Protocol::WebSocket::Handshake::Server

Server handshake parser and constructor.

    Protocol::WebSocket::Handshake::Client

Client handshake parser and constructor.

    Protocol::WebSocket::Frame

WebSocket frame parser and constructor.

    Protocol::WebSocket::Request

Low level WebSocket request parser and constructor.

    Protocol::WebSocket::Response

Low level WebSocket response parser and constructor.

    Protocol::WebSocket::URL

Low level WebSocket url parser and constructor.

EXAMPLES

For examples on how to use Protocol::WebSocket with various event loops see examples/ directory in the distribution.

CREDITS

In order of appearance:

Paul LeoNerd Evans

Jon Gentle

Lee Aylward

Chia-liang Kao

AUTHOR

Viacheslav Tykhanovskyi, vti@cpan.org.

COPYRIGHT

Copyright (C) 2010-2011, Viacheslav Tykhanovskyi.

This program is free software, you can redistribute it and/or modify it under the same terms as Perl 5.10.

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


perl v5.20.3 PROTOCOL::WEBSOCKET (3) 2011-10-25

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