Commits on Dec 18, 2011
This change allows websocket connections to be set up between browsers and the yaws server. RFC 6455 for WebSocket connections is supported, in addition to the hybi working group RFC drafts 10 to 17. The quickest way to try this out is by compiling yaws as usual, then visiting /websockets_example.yaws at the default local installation host. This can be done using Google Chrome 14+, Firefox 7+ or any other browser supporting WebSocket version 8 or above. Information about getting started with WebSockets using this implementation is given in /websockets.yaws. This drops support for the older draft RFCs, specifically those of the hixie working group which were previously supported by yaws but are significantly different from the hybi working group's specification. The interface for using WebSocket with yaws has changed somewhat. Instead of spawning a websocket owner process which maintains a server loop such as that shown in the old websockets_endpoint.yaws, the application developer now implements a callback module such as those in src/basic_echo_callback.erl or src/advanced_echo_callback.erl -- the difference being that the advanced callback style is only necessary if you need advanced features of WebSocket such as fragmented messages. One suggested way to deploy your callback module and its dependencies is as part of an application in an OTP release, with yaws as a dependency. Rebar can be used to build the dependencies, fetch and build yaws, and create a release which will ensure the modules are in the path of the runtime system. Most behaviour tested by the Autobahn test suite 0.43 pass when configured to connect to the /websockets_autobahn_endpoint.yaws and /websockets_example_endpoint.yaws over an unencrypted connection. Significantly, websocket connection closing is not implemented and the socket is left to be cleaned up by the Runtime System when either the connection is lost or the owning processes dies. Secondly, certain cases where websocket frames are fragmented within UTF-8 code points cause the check for valid text type messages to incorrectly fail the connection. Subprotocols are not currently supported. Augment yaws.tex with a new WebSocket Protocol chapter (Steve Vinoski).