websockets: add support for user specified onmessage
Better connection / password error handling