<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/opt/local/share/tsung/tsung-1.0.dtd" []>
<tsung loglevel="notice" version="1.0">
  <clients>
    <client host="localhost" use_controller_vm="true" maxusers="1000" />
  </clients>

  <servers>
    <server host="127.0.0.1" port="8080" 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="/chat"></websocket>
        </request>

        <request>
            <dyn_variable name="uid" jsonpath="uid"/>
            <websocket type="message">{"user":"user", "password":"password"}</websocket>
        </request>

        <request subst="true">
            <match do="log" when="nomatch">ok</match>
            <websocket type="message">{"uid":"%%_uid%%", "data":"data"}</websocket>
        </request>

        <request>
            <websocket type="message" ack="no_ack">{"key":"value"}</websocket>
        </request>

        <request>
            <websocket type="close"></websocket>
        </request>
    </session>
  </sessions>
</tsung>
