Giter Club home page Giter Club logo

erlang-spdy's Introduction

Erlang SPDY

This is a library application designed to make it easy to add SPDY support to other erlang apps, specifically webservers like cowboy, misultin and mochiweb.

This app does contain a basic demo server which just returns a "Hello World" response to a GET / request received over SPDY. You should really use an existing server, or at least a more robust tcp listener/acceptor method.

To run the demo server:

$ rebar compile                            # compile everything
$ erl -pa ebin/ -boot start_sasl -s espdy  # espdy app doesn't run anything
erl> espdy_demo_server:start(6121, false). # start server, non-ssl

Current Status

The demo serves up a nice hardcoded page, and can handle a SPDY v2 session properly to chrome.

No flow control, although that got pushed into SPDY/3 anyway

Probably some other stuff to mention here.

Testing SPDY with Chrome

Run Chrome with these flags:

--use-spdy=no-ssl --new-window --user-data-dir=/tmp/foo

This will open a new chrome window:

  • with a new chrome profile, ignoring your existing settings
  • in SPDY-only mode - sites using normal HTTP will not load
  • force SPDY to not use SSL, for simpler testing

Now go to http://localhost:6121/ in the new Chrome window.

You can view stats on Chrome's SPDY status at chrome://net-internals/#spdy However, it crashes with --use-spdy=no-ssl unless you have a very recent version. I'm testing with stunnel and https, and it works fine when Chrome is started with --use-spdy=ssl

OS X example

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --use-spdy=no-ssl --new-window --user-data-dir=/tmp/foo http://localhost:6121/ 

Linux example

chromium-browser --use-spdy=no-ssl --new-window --user-data-dir=/tmp/foo  http://localhost:6121/ 

Erlang SPDY Design Notes

This library is useful once you have accepted a socket that will be used for the SPDY protocol. Once accepted, you start a espdy_session process, providing a callback module. (See the demo server).

espdy_session will spawn a espdy_stream process for each new stream.

espdy_stream uses the callback module to respond to SPDY requests.

Two zlib contexts are maintained for each session. For inflating and deflating.

espdy_parser takes care of all the binary-to-record work and visa-versa, and requires a compression context to use.

SPDY Resources

http://dev.chromium.org/spdy

Chrome supports SPDY v2 spec currently:

SPDY v3 is being specced, but is not in the wild yet afaik.

erlang-spdy's People

Contributors

rj avatar puzza007 avatar

Watchers

James Cloos 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.