For convenient use of websockets in webmachine, I implemented this by modifying the sources of webmachine (adding support for mochiweb_websockets) and mochiweb (add secure support sites).
You can download the complete solution (webmachine with websockets support) from git at this link: https://github.com/Dryymoon/webmachine.git
And at this link an example of using the solution.
Or, if you want to dig a little deeper: I only changed two source files:
1) changed webmachine_decision_core.erl (add websocket support handler).
2) mochiweb_websocket.erl (add secure support web interfaces and existig patch).
source share