anchor.diff:  handle_control(_,_) ->
       ok.
   
  -cont_op(Cop, ?OP_cont) ->
  +op_cont(Cop, ?OP_CONT) ->
       Cop;
  -cont_op(_, Op) ->
  +op_cont(_, Op) ->
       Op.
   
   key() ->
  
positive.code: 
  init([Url]) ->
      {ok,{ws,[],Host,Port,Path,[]}} = http_uri:parse(Url),
      {ok, #state{readystate = ?DISCONNECTED, key = key(), host = Host, 
  		port = Port, path = Path,buffer = <<>>}}.
  
  handle_call(_Request, _From, State) ->
      {reply, ok, State}.
  
  handle_cast({connect,Pid}, State = #state{host = Host, port = Port, 
  					  path = Path, key = Key}) ->
      {ok, Sock} = gen_tcp:connect(Host, Port, [binary, {packet, 0},
  					      {active,true}]),
      Req = initial_request(Host, Port, Path, Key),
      inet:setopts(Sock, [{packet, http}]),
      ok = gen_tcp:send(Sock, Req),
      {noreply, State#state{sock = Sock, listener = Pid}};
  handle_cast({send, Op, Data}, State = #state{sock = Sock}) ->
      ok = gen_tcp:send(Sock, frame(Op,Data)),
      {noreply, State}.
  
  handle_info({http,_,{http_response,{1,1},101,_}}, 
  	    State = #state{readystate = ?DISCONNECTED}) ->
      {noreply, State#state{readystate = ?CONNECTING}};
  handle_info({http,_,{http_header,_,Name,_,Value}}, 
  	    State = #state{readystate = ?CONNECTING}) ->
      H = [{Name, Value} | State#state.headers],
      {noreply, State#state{headers=H}};
  handle_info({http,_,http_eoh}, State = #state{readystate = ?CONNECTING}) ->
      {noreply, handshake(State)};
  handle_info({tcp,_,Frame}, State = #state{readystate = ?OPEN, sock = Sock,
  					  contop = Cop,
  					  listener = Listener,
  					  buffer = Buffer}) ->
      New_state = case unframe(Frame) of
  		    {Op, Data, 0} ->
  			State#state{buffer = <<Buffer/binary, Data/binary>>, 
  				    contop = cont_op(Cop, Op)}; 
  		    {Op, Data, 1} -> 
                          Opcode = cont_op(Cop, Op),
  			Listener ! {Opcode, <<Buffer/binary, Data/binary>>},
  			handle_control(Opcode, Sock),
  			State#state{buffer = <<>>} 
  		end,
      {noreply, New_state};
  handle_info({tcp_closed, _Socket},State) ->
      {stop,normal,State#state{readystate = ?CLOSED}};
  handle_info({tcp_error, _Socket, _Reason},State) ->
      {stop,tcp_error,State#state{readystate = ?CLOSED}};
  handle_info(_, State) ->
      {noreply, State}.
  
  
negative.code:     mask(Data, <<Mask:32>>).
  
  op_to_atom(?OP_TEXT) -> text;
  op_to_atom(?OP_BINARY) -> binary;
  op_to_atom(?OP_PING) -> ping;
  op_to_atom(?OP_PONG) -> pong;
  op_to_atom(?OP_CLOSE) -> close.
  
  unframe(<< F:1, _:3, Op:4, M:1, Data/bits >>) ->
      {Len, Rest} = decode_len(Data),
  