Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support <open>,<close> frames with XMPP+websocket #164

Closed
SwethaGRaj opened this issue Apr 6, 2016 · 2 comments · Fixed by #397
Closed

Support <open>,<close> frames with XMPP+websocket #164

SwethaGRaj opened this issue Apr 6, 2016 · 2 comments · Fixed by #397

Comments

@SwethaGRaj
Copy link

The current implementation of websocket support over XMPP does not support open and close frames.

This must be added to be compliant with RFC 7395

@pyprasad
Copy link
Contributor

+1

@guusdk
Copy link

guusdk commented Jul 26, 2022

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>

weiss added a commit to weiss/tsung that referenced this issue Jul 26, 2022
If '<jabber type="connect" version="websocket" [...]/>' is specified,
use RFC 7395 framing for opening and closing the stream.

Resolves processone#164.
weiss added a commit to weiss/tsung that referenced this issue Jul 27, 2022
If '<jabber type="connect" version="websocket" [...]/>' is specified,
use RFC 7395 framing for opening and closing the stream.

Resolves processone#164.
weiss added a commit to weiss/tsung that referenced this issue Jul 27, 2022
If '<jabber type="connect" version="websocket" [...]/>' is specified,
use RFC 7395 framing for opening and closing the stream.

Resolves processone#164.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants