我正在尝试加载测试websocket服务器。服务器接受并发送application / json,交互似乎相当不错。
服务器正确接受从客户端发送的消息(tsung)。不幸的是,从客户端的角度来看,它无法读取响应,我认为可能与至少在查看tsung.dump的消息有关,我看到像NUL,SOH,SI等的ASCII字符,但我也看到了json的响应来自服务器莫名其妙。
这是我的tsung.xml文件片段:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/Cellar/tsung/1.5.0/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" dumptraffic="true">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="1000" />
</clients>
<servers>
<server host="127.0.0.1" port="8282" type="tcp" />
</servers>
<load>
<arrivalphase phase="1" duration="120" unit="second">
<users maxnumber="1" arrivalrate="1" unit="second" />
</arrivalphase>
</load>
<sessions>
<session name="websocket" probability="100" type="ts_websocket">
<request subst="true">
<websocket type="connect" path="/fancyurl?Content-Type=application/json"></websocket>
</request>
<transaction name="getsession">
<request subst="true">
<dyn_variable name="sessionid" jsonpath="session"/>
<websocket type="message">{"type": "EventMessageCmd", "user": "lnramirez", "eventCode" : "epfl"}
</websocket>
</request>
</transaction>
<thinktime value="10"/>
<request>
<dyn_variable name="boothAck" jsonpath="commandStatus" />
<websocket type="message">
{
"user": "lramirezmonterosa",
"eventCode": "epfl",
"type": "BoothMessageCmd",
"boothCode": "ic",
"commandStatus": "REQUESTED",
"boothRequest": "JOIN"
}
</websocket>
</request>
<request>
<websocket type="close"></websocket>
</request>
</session>
</sessions>
</tsung>
tsung.dump:
Send:1390970727.56257:<0.84.0>:‚ìÝju¦`U_ýJU_ýJU_ýJU_ÿ¸HO_ÿ/³8®¸)ÿFU]¨
ÿPU]±´°¸¼HY_ÿ³6¹W_çJW]×JU_ýJU_ýJU_ýJU
Recv:1390970727.588689<0.84.0>:~{"type":"HeartBeatMessageCmd","timeCmdBroadcasted":1390970727588,"timeCmdGenerated":1390970727588,"commandStatus":"REQUESTED","user":"lramirezmonterosa","eventCode":"epfl","uuid":"a91e2c1b-859d-4299-99fd-e7ba63ba1f42","userSession":"25bb5627-4eb3-4a23-a1c9-edd5b8231808"}`