Code Monkey home page Code Monkey logo

Comments (2)

pyprasad avatar pyprasad commented on May 18, 2024

+1

from tsung.

guusdk avatar guusdk commented on May 18, 2024

With the latest code, this still seems to be a problem. When trying to use Jabber over websockets, Tsung will send (unterminated) <stream elements as the websocket data, instead of the open and close elements.

I have verified that with simple string substitution (performed 'in-flight'), Tsung can successfully interact with an XMPP server over websockets. These are the substitutions required:

if (stanza.startsWith("<?xml version='1.0'?><stream:stream ")) {
    stanza = stanza.replace("<?xml version='1.0'?><stream:stream ", "<open ");
    stanza = stanza.replace("jabber:client", "urn:ietf:params:xml:ns:xmpp-framing");
    stanza += "</open>";
}
if (stanza.startsWith("</stream:stream>")) {
    stanza = stanza.replace("</stream:stream>", "<close xmlns='urn:ietf:params:xml:ns:xmpp-framing' />");
}

For completeness, this is the Tsung configuration that I'm using, with Tsung as build based on code of version 1.7 (development):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0" dumptraffic="true">

  <clients>
    <client host="localhost" use_controller_vm="true" />
  </clients>

  <servers>
    <server host="172.17.0.1" port="7070" type="websocket" />
  </servers>

  <load>
    <arrivalphase phase="1" duration="1" unit="second">
      <users interarrival="1" unit="second" />
    </arrivalphase>
  </load>

  <options>
    <option type="ts_jabber" name="global_number" value="1000" />
    <option type="ts_jabber" name="userid_max" value="10000" />
    <option type="ts_jabber" name="domain" value="example.org" />
    <option name="websocket_path" value="/ws" />
    <option name="websocket_frame" value="text" />
    <option name="websocket_subprotocols" value="xmpp" />
  </options>

  <sessions>
    <session bidi="true" probability="100" name="xmpp-over-websockets" type="ts_jabber">
      <request>
        <!-- This seems to send '<stream' where '<open' is needed. -->
        <jabber type="connect" ack="local"/>
      </request>

      <transaction name="authenticate">
        <request>
          <jabber type="auth_sasl_anonymous" ack="local"></jabber>
        </request>

        <request>
          <jabber type="connect" ack="local"></jabber>
        </request>

        <request>
          <jabber type="auth_sasl_bind" ack="local"></jabber>
        </request>

        <request>
          <jabber type="auth_sasl_session" ack="local"></jabber>
        </request>

      </transaction>

      <request>
        <jabber type="presence:initial" ack="local"/>
      </request>

      <request>
        <jabber type="close" ack="local" />
      </request>
    </session>
  </sessions>
</tsung>

from tsung.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.