The problem was that I was using close codes 1000-1015 and QWebsocket appeared to be disagreeing with their usage and reported 1002, probably because they were being misused. The solution was to just use close codes in the 4000+ range.