How do handle Dynamic values (correlation ) for websocket protocol

Hi team,

I am recording an application which communicates Websockets for its communication. 

I do see there are few session ids and cookie values in the action.c , and the same cookie and session are assigned by the tool at the time of recording to an array in websocketbuffer.h 

 

I need to understand how to handle correlation for this values? where should i place the correlation function?

Also the  session value is being passed into the header  first and  i am not finding the boundaries to place it .

 

Are there any videos that helps me to understand the webocket protocol.

 

Regards,

Sagar. 

  • Hi Sagar,

     

    The arrays in websocketbuffer.h are the buffers received by the client, they don't have to be used. You could search the array name in the script, there should be no reference if your script is generated automatically, then you could ignore it.

     

    For correlation just focus on the action.c is ok. if automatical correlation doesn't return the result you need, you could do manual correlation. Select the id at its first occured place, right click and choose Correlate Selection. It is same with the normal web protocols.

     

    Ellie

  • hi,

     

    as perviously said, the WebSocketBuffer.h file contail buffers sent and recieved during recording

    for sent buffers, if the sent data is alrger than 1024 then the data will be in the buffers headers in order to keep the action.c file "cleaner". the recieved buffers are saved for reference only.

     

    in every websocket connet step you have several callback funtions  to handle recieved messages from the server for each WebSocket event (connect, message, error) - you can see these Callback functoins in the  WebSocketCB.c file.

     

    there you can access the recieved data from the server and save the data to a parameter if correlation is needed.

     

    you can see more info on the WebSocket blog post:

    http://h30499.www3.hp.com/t5/HP-LoadRunner-and-Performance/Async-Communications-The-WebSocket-protocol-made-easy-in/ba-p/6469242

     

    i am attaching a demo script for monitoring Socket.io server

     

     

    socketio_monitor.zip
  • Hi Moshka, 
    Thank you for your repy. Actual I am not able to capture the dynamic values from the server logs. when i am running the script in  extended log i am able to see there is a cookie key value and insight value that is  being returned by the server.

    these values  i need to correlate. however when  i  place the values in the correlation function ,it is not finding  the value. i placed it one step and at different steps before it is generated by the server. But it is not working. 

    here is the extended log information. 

     

        web_reg_save_param_ex("Paramname=Ccook",
                          "LB=frmLogin.close();document.cookie=\"CookieKey=",
                          "RB=}; path=/;\";",
                          "Ordinal=All",SEARCH_FILTERS,
                          "Scope=all",
                          LAST);

     

        web_websocket_send("ID=0", 
            "Buffer=PathInfo=logOn&Ctx=&Usr=xxxx&Pwd=yyyy&", 
            "IsBinary=0", 
            LAST);

     

    i see the cookie value is returned after the "websocket_send ", but if i place  the function before it , it is not capturing the dyamic value.

     

    *************************************************

     

    Action.c(113): Retaining websocket connection of URI="ws://x.x.x/websockets/58927" (RelFrameId=1, Internal ID=27) [MsgId: MMSG-27641]
    Action.c(113): Close: reason=NO_REASON, code = 1000 [MsgId: MMSG-26000]
    Action.c(62): t=3579ms: 8-byte request body for "ws://192.1/websockets/58927" (RelFrameId=1, Internal ID=27) [issued at Action.c(113)]
    Action.c(113): \x88\x82~\x04A }\xEC
    Action.c(62): t=3644ms: 238-byte response body for "ws://x.x.x./websockets/58927" (RelFrameId=1, Internal ID=27) [issued at Action.c(113)]
    Action.c(113): \x81~\x00\xEAfrmLogin.close();document.cookie="CookieKey={6D0B19C7-EC9F-49A3-92C3-5C9E7CFF
    Action.c(113): C2B0}; path=/;";document.location.replace("/WebErp/ConnectTo?InsKey={E81F789E-39A5-4E79-83
    Action.c(113): 20-C9AE73A0EDC8}&BasicObj=PC_WEB&CPY=DEMO_QI_F&Obj=PC_PORTAL_PCS");
    Action.c(62): t=3645ms: 2-byte response body for "ws://x.x.x.x/websockets/58927" (RelFrameId=1, Internal ID=27) [issued at Action.c(113)]
    Action.c(113): \x88\x00
    Action.c(113): Connection Closed: uri=ws://x.x.x.x/websockets/58927, connection handle=106364520 [MsgId: MMSG-26000]
    Action.c(113): Calling Vuser script function "OnCloseCB0", specified via the "OnCloseCB" argument of "web_websocket_connect" in Action.c(62) [MsgId: MMSG-26419]
    Action.c(113): Returned (rc=0) from Vuser script function "OnCloseCB0", specified via the "OnCloseCB" argument of web_websocket_connect in Action.c(62) [MsgId: MMSG-26418].

     

     

     

     

    Regards,

    Sagar

  • Actually, i have recorded the flow in fiddler and i see the cookie and insight key values are generated at web_socket_Connect step  . i could see the boundaries as 

    frmLogin.close();document.cookie="CookieKey={

    rmLogin.close();document.cookie=\"CookieKey={9345C558-DFA2-4E94-86FB-284B78832F"
                            "6E}; path=/;\";document.location.replace(\"/WebErp/ConnectTo?InsKey={ECC13791-78"
                            "69-44F2-9B03-B7EA86DC44B8}&BasicObj=PC_WEB&CPY=DEMO_QI_F&Obj=PC_PORTAL_PCS\");";

     

    but  when i place the function in the script it is not picking the values  for cookie and insight key.

     

     

    web_reg_save_param_ex("paramname=Ccook",
                       "LB=frmLogin.close();document.cookie=\"CookieKey={",
                           "RB=};",
                           "Ordinal=All",LAST);
        
        
        
        //frmLogin.close();document.cookie="CookieKey={40E509C0-EDC0-4FE9-A085-B2B23418180B}; path=/;";
        
        
        web_websocket_connect("ID=0",
            "URI=ws://x.X.x.x/websockets/{Cwebsocket}", 
            "Origin=http://x.x.x.x", 
            "OnOpenCB=OnOpenCB0", 
            "OnMessageCB=OnMessageCB0", 
            "OnErrorCB=OnErrorCB0", 
            "OnCloseCB=OnCloseCB0", 
            LAST);

     

     

    Please  help me here.

     

    Thank You.

    Sagar

     

     

     

  • hi,

     

     

    it looks like you are trying to use web_reg_* on the websocket connect step,

     

    you should get the headers value on the  OnOpenCB0 callback function