parameters: (self, data)
docstring: Parse data to read WebSocket frames.
  
          @param data: data received over the WebSocket connection.
          @type data: C{str}
docstring_summary: Parse data to read WebSocket frames.
docstring_tokens: Parse data to read WebSocket frames .
function: def dataReceived(self, data):
          """
          Parse data to read WebSocket frames.
  
          @param data: data received over the WebSocket connection.
          @type data: C{str}
          """
          if not data:
              return
          while True:
              endIndex = data.find("\xff")
              if endIndex != -1:
                  self._currentFrameLength += endIndex
                  if self._currentFrameLength > self.MAX_LENGTH:
                      self.handler.frameLengthExceeded()
                      break
                  self._currentFrameLength = 0
                  frame = "".join(self._data) + data[:endIndex]
                  self._data[:] = []
                  if frame[0] != "\x00":
                      self.request.transport.loseConnection()
                      break
                  self.handler.frameReceived(frame[1:])
                  data = data[endIndex + 1:]
                  if not data:
                      break
                  if data[0] != "\x00":
                      self.request.transport.loseConnection()
                      break
              else:
                  self._currentFrameLength += len(data)
                  if self._currentFrameLength > self.MAX_LENGTH + 1:
                      self.handler.frameLengthExceeded()
                  else:
                      self._data.append(data)
                  break
function_tokens: def dataReceived ( self , data ) : if not data : return while True : endIndex = data . find ( "\xff" ) if endIndex != - 1 : self . _currentFrameLength += endIndex if self . _currentFrameLength > self . MAX_LENGTH : self . handler . frameLengthExceeded ( ) break self . _currentFrameLength = 0 frame = "" . join ( self . _data ) + data [ : endIndex ] self . _data [ : ] = [ ] if frame [ 0 ] != "\x00" : self . request . transport . loseConnection ( ) break self . handler . frameReceived ( frame [ 1 : ] ) data = data [ endIndex + 1 : ] if not data : break if data [ 0 ] != "\x00" : self . request . transport . loseConnection ( ) break else : self . _currentFrameLength += len ( data ) if self . _currentFrameLength > self . MAX_LENGTH + 1 : self . handler . frameLengthExceeded ( ) else : self . _data . append ( data ) break