refactor main read_websocket
enhance graceful close with OPCOE_CLOSE and fixed memory leak
(tested in OSX 10.7.5, 10.8.3).
Merge branch 'develop'