class DEBUGGER__::UI_CDP::WebSocketClient

def extract_data

def extract_data
  first_group = @sock.getbyte
  fin = first_group & 0b10000000 != 128
  raise 'Unsupported' if fin
  opcode = first_group & 0b00001111
  raise "Unsupported: #{opcode}" unless opcode == 1
  second_group = @sock.getbyte
  mask = second_group & 0b10000000 == 128
  raise 'The server must not mask any frames' if mask
  payload_len = second_group & 0b01111111
  # TODO: Support other payload_lengths
  if payload_len == 126
    payload_len = @sock.read(2).unpack('n*')[0]
  end
  msg = @sock.read payload_len
  show_protocol :<, msg
  JSON.parse msg
end