Protocol::WebSocket
Perl
Latest commit 056ab52 Nov 4, 2016 @vti Checking in changes prior to tagging of version 0.20.
Changelog diff is:

diff --git a/Changes b/Changes
index 8f77103..f69ed2e 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@ Revision history for perl module Protocol::WebSocket

 {{$NEXT}}

+0.20 2016-11-04T18:21:37Z
+
  - RSV bit (Anton Petrusevich)
  - do not modify passed headers structure (Graham Ollis)
  - bypass max payload size (Graham Ollis)
Permalink
Failed to load latest commit information.
examples Cleanup Oct 18, 2012
lib/Protocol Checking in changes prior to tagging of version 0.20. Nov 4, 2016
t optionally turn off max_payload_size Nov 4, 2016
util test and docs Feb 11, 2014
xt Created author tests and fixed pod Mar 15, 2011
.gitignore gitignore MYMETA.json Oct 29, 2016
Build.PL Checking in changes prior to tagging of version 0.20. Nov 4, 2016
Changes Checking in changes prior to tagging of version 0.20. Nov 4, 2016
LICENSE Add license Oct 13, 2013
MANIFEST.SKIP Fixed manifest.skip Mar 15, 2011
README.md Checking in changes prior to tagging of version 0.20. Nov 4, 2016
cpanfile
minil.toml meta files update Jan 7, 2014

README.md

NAME

Protocol::WebSocket - WebSocket protocol

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

my $frame = $hs->build_frame;

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

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

        # Send close frame back
        send(
            $hs->build_frame(
                type    => 'close',
                version => $version
            )->to_bytes
        );

        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 (with HAProxy support)
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:

High-level modules

Protocol::WebSocket::Server

Server helper class.

Protocol::WebSocket::Client

Client helper class.

Low-level modules

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

Atomer Ju

Chuck Bredestege

Matthew Lien (BlueT)

Joao Orui

Toshio Ito (debug-ito)

Neil Bowers

Michal Špaček

Graham Ollis

Anton Petrusevich

AUTHOR

Viacheslav Tykhanovskyi, vti@cpan.org.

COPYRIGHT

Copyright (C) 2010-2014, Viacheslav Tykhanovskyi.

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