anchor.diff:      B_v = B band 16#7F,
       NewLength = (Length * 128) + B_v,
       case B band 16#80 of
  -	16#80 ->
  -	    unpack_length(Binary, LenBytes + 1, NewLength);
  -	0 ->
  -	    {NewLength, LenBytes + 1}
  +    16#80 ->
  +        unpack_length(Binary, LenBytes + 1, NewLength);
  +    0 ->
  +        {NewLength, LenBytes + 1}
       end.
   
   %% @doc Pack the length in 7 bits bytes
  
positive.code:         true -> 
              handle_data(<<>>, nolength, T, Socket, Context);
          false ->
      	    {Length, LenBytes} = unpack_length(T),
      	    <<_:LenBytes/bytes, Rest:Length/bytes>> = T,
      	    handle_data(<<>>, Length, Rest, Socket, Context)
      end;
  
  %% Extract frame ending with 255
  handle_data(none, nolength, <<>>, Socket, Context) ->
      resource_websocket:loop(none, nolength, Socket, Context);
  handle_data(Msg, nolength, <<255,T/binary>>, Socket, Context) ->
      handle_message(Msg, Context),
      handle_data(none, nolength, T, Socket, Context);
  
negative.code: websocket_start(ReqData, Context) ->
      ContextReq = ?WM_REQ(ReqData, Context),
      Context1 = z_context:ensure_all(ContextReq),
  
      %% Sec-Websocket stuff
      Key1 = process_key(z_context:get_req_header("sec-websocket-key1", Context1)),
      Key2 = process_key(z_context:get_req_header("sec-websocket-key2", Context1)),
      Socket = webmachine_request:socket(ReqData),
      {ok, Body} = gen_tcp:recv(Socket, 8),
      SignKey = crypto:md5(<<Key1:32/integer, Key2:32/integer, Body/binary>>),
  
      %% Send the handshake
      Hostname = m_site:get(hostname, Context1),
      WebSocketPath = z_dispatcher:url_for(websocket, [{z_pageid, z_context:get_q("z_pageid", Context1)}], Context1),
      Data = ["HTTP/1.1 101 Web Socket Protocol Handshake", 13, 10,
              "Upgrade: WebSocket", 13, 10,
              "Connection: Upgrade", 13, 10,
              "Sec-WebSocket-Origin: http://", Hostname, 13, 10,
              "Sec-WebSocket-Location: ws://", Hostname, WebSocketPath, 13, 10,
              "Sec-WebSocket-Protocol: zotonic", 13, 10,
              13, 10,
              <<SignKey/binary>>
              ],
      ok = send(Socket, Data),
      spawn_link(fun() -> start_send_loop(Socket, Context1) end),
      loop(none, nolength, Socket, Context1).
  
  %% @doc Start receiving messages from the websocket
  loop(Buff, Length, Socket, Context) ->
  