Check for null websocket

Fix #744
Merge pull request #745 from bootstraponline/fix_null

Check for null websocket