Giter Club home page Giter Club logo

protocol-websocket's Introduction

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

Server helper class.

Client helper class.

Low-level modules

Server handshake parser and constructor.

Client handshake parser and constructor.

WebSocket frame parser and constructor.

Low level WebSocket request parser and constructor.

Low level WebSocket response parser and constructor.

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

Eric Wastl

Greg Kennedy

AUTHOR

Viacheslav Tykhanovskyi, [email protected].

COPYRIGHT

Copyright (C) 2010-2018, Viacheslav Tykhanovskyi.

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

protocol-websocket's People

Contributors

debug-ito avatar greg-kennedy avatar michal-josef-spacek avatar clkao avatar plicease avatar bluet avatar lighterowl avatar leonerd avatar topaz avatar jfsso avatar atrodo avatar jbarber avatar leedo avatar neilb avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.