使用loadrunner12录制websocket协议的问题

使用loadrunner12录制websocket协议,目前能录制下来,如下代码,但是需要关联sessionid,不知道使用什么关联函数,试了好几个都不好使


Action()

{

     web_url( "index.html"
         "URL=http://172.16.161.72:8090/iwc/index.html?xeguid=B3845F0D5C154A55A3AD168F33AF7410-FC1E4B61C4684D25AADDD2A6A36E1DC0&username=seny&token=aaa&scrollall=yes"
         "Resource=0"
         "Referer="
         "Snapshot=t4.inf"
         "Mode=HTML"
         EXTRARES
         LAST);

     web_websocket_connect( "ID=0"
         "URI=ws://172.16.161.72:5000/"
         "Origin=http://172.16.161.72:8090"
         "OnOpenCB=OnOpenCB0"
         "OnMessageCB=OnMessageCB0"
         "OnErrorCB=OnErrorCB0"
         "OnCloseCB=OnCloseCB0"
         LAST);

     web_websocket_send( "ID=0"
         "Buffer={\"head\":{\"cmdName\":\"CreateSession\",\"msgID\":1,\"uData\":\"\",\"token\":\"aaa\"},\"body\":{\"userName\":\"seny\"}}"
         "IsBinary=0"
         LAST);
    

     web_websocket_send( "ID=0"
         "Buffer={\"head\":{\"cmdName\":\"GetStudyInfo\",\"msgID\":2,\"uData\":\"\",\"token\":\"aaa\"},\"body\":{\"xeGUID\":\"B3845F0D5C154A55A3AD168F33AF7410\",\"detailCount\":1,\"sessionID\":\"FA99EA17DF0347CB811957E43B5B9D509D50\"}}"
         "IsBinary=0"
         LAST);


     web_websocket_send( "ID=0"
         "Buffer={\"head\":{\"cmdName\":\"GetImages\",\"msgID\":3,\"uData\":\"\",\"token\":\"aaa\"},\"body\":{\"xeGUID\":\"B3845F0D5C154A55A3AD168F33AF7410\",\"sessionID\":\"FA99EA17DF0347CB811957E43B5B9D509D50\",\"seriesIndex\":8,\"currentImages\":[{\"tileIndexes\":[],\"index\":0,\"level\":\"1+\"}],\"reservedImages\":null,\"cancelledMsgIDs\":[null]}}"
         "IsBinary=0"
         LAST);



     web_websocket_send( "ID=0"
         "Buffer={\"head\":{\"cmdName\":\"GetImages\",\"msgID\":4,\"uData\":\"\",\"token\":\"aaa\"},\"body\":{\"xeGUID\":\"B3845F0D5C154A55A3AD168F33AF7410\",\"sessionID\":\"FA99EA17DF0347CB811957E43B5B9D509D50\",\"seriesIndex\":8,\"currentImages\":null,\"reservedImages\":[{\"tileIndexes\":[],\"index\":1,\"level\":\"1\"},{\"tileIndexes\":[],\"index\":2,\"level\":\"1\"},{\"tileIndexes\":[],\"index\":3,\"level\":\"1\"},{\"tileIndexes\":[],\"index\":4,\"level\":\"1\"}],\"windowCenter\":90,\"windowWidth\":500,"
         "\"forceWW\":1,\"cancelledMsgIDs\":[3]}}"
         "IsBinary=0"
         LAST);

    

     return  0;
}

你可能感兴趣的:(使用loadrunner12录制websocket协议的问题)