SockJS: race-condition ironed out, improved design