Fixing memory leak while using websockets.
Merge pull request #157 from vinodc/ws-memory-leak-fix

Fixing memory leaks while using websockets.