minor improvements following willem's comments:

- foldl -> Foldr
- change way of detecting WebSockets to what modernizr do
- some comments in doing