The unmasked NSData that are being allocated in socket:didReadData:withTag: (tag = 6) isn't cut to it's correct size before sending it to the delegate. Therefore the delegate method, webSocketServer:didReceiveData:fromConnection:, gets called with too much data (= unmaskedData + waste data).