All it takes to detect websockets is:
if ('WebSocket' in window) { /* Web Sockets supported / } else { / Web Sockets not supported */ }
Ironically, this was taken from:
http://dev.opera.com/articles/view/introducing-web-sockets/
Also, every web developer with half a brain can use https://github.com/gimite/web-socket-js instead of locking out users unnecessarily by matching the User-Agent.