5 Replies Latest reply on Aug 30, 2013 10:56 AM by Clebert Suconic

    Using stomp.js with jboss-eap-6.1.0.Alpha

    execretor Newbie

      I have another problem with stomp.js library(http://jmesnil.net/stomp-websocket/doc/)

       

      I use this client code:

       

       

      <html>

      <script type="text/javascript" src="stomp.js" ></script>

      <script type="text/javascript">

      function createStompClient()

      {

      var stomp = Stomp.client("ws://localhost:61614/stomp");

       

      stomp.debug = function(str) {

      alert("Debug  " + str)

      }

       

      error_callback = function(error) {

      alert(error);

      }

       

      subscribe_callback = function(message) {

      alert(message);

      }

       

       

      connect_callback = function() {

      stomp.subscribe("/alarms/queue", subscribe_callback);

      }

       

       

      stomp.connect("USXXXX", "PSXXXX", connect_callback, error_callback);

      }

      </script>

      <body onload="createStompClient()">

       

      </body>

      </html>

       

       

      With Opera browser, I  have this workflow :

      -Opening websocket

      -Websocket opened

      -Send

         Connect

          accept-version:1.1,1.0

          heart-beat:10000,10000

          login:USXXXX

          passcode:PSXXXX

      -got data length 68

      -ERROR

      version:1.0,1.1

      content-length:43

       

      Supported protocol versions are 1.0 and 1.1

       

      (Nothing in jboss console)

       

       

      With Firefox browser, this workflow

      -Opening websocket

      (In Jboss console this message after  some seconds:  Connection failure has been detected: Did not receive data....)

       

       

      How can I do for use stomp client with websockets?

        • 1. Re: Using stomp.js with jboss-eap-6.1.0.Alpha
          Jeff Mesnil Master

          what's the messaging subsystem configuration you used?

          • 2. Re: Using stomp.js with jboss-eap-6.1.0.Alpha
            execretor Newbie

            Attached my standalone-full.xml

            • 3. Re: Using stomp.js with jboss-eap-6.1.0.Alpha
              Jeff Mesnil Master

              I managed to connect succesfully with AS8 master branch.

               

              The error reported by HornetQ is misleading. The root issue is that the user authentication failed[1]

              Did you correctly add a user using the add-user.sh script?

               

              Once I did that, I was able to communicate successfully with Stomp over WebSocket:

               

              >>> CONNECT

              accept-version:1.1,1.0

              heart-beat:10000,10000

              login:admin

              passcode:adminadmin12#

               

              --- got data length: 140

              <<< CONNECTED

              version:1.1

              session:-935684956

              server:HornetQ/2.3.0.CR2 (black'n'yellow2, 123) HornetQ Messaging Engine

              heart-beat:10000,10000   

              connected to server HornetQ/2.3.0.CR2 (black'n'yellow2, 123) HornetQ Messaging Engine

              send PING every 10000ms

              check PONG every 10000ms

              connected to Stomp

               

              >>> SUBSCRIBE

              id:sub-0

              destination:jms.topic.alarmQueue  

               

              >>> SEND

              destination:jms.topic.alarmQueue

              content-length:4 

               

              test

               

              --- got data length: 161

              <<< MESSAGE

              subscription:sub-0

              content-length:4

              message-id:17

              destination:jms.topic.alarmQueue

              expires:0

              redelivered:false

              priority:4

              timestamp:1365668544381 

               

              test

               

              I checked it with Chrome, Firefox and Safari.

               

              By the way, there is a more correct way to configure the acceptor for Stomp over WebSocket:

               

              add a netty-acceptor instead of a plain acceptor:

               

                                  <netty-acceptor name="stomp-ws" socket-binding="messaging-stomp-ws">

                                      <param key="protocol" value="stomp_ws" />

                                  </netty-acceptor>

               

              and a corresponding socket-binding (at the end of the standalone-full.xml) file:

               

                      <socket-binding name="messaging-stomp-ws" port="61614"/>

               

              [1] https://issues.jboss.org/browse/HORNETQ-1175

              • 4. Re: Using stomp.js with jboss-eap-6.1.0.Alpha
                execretor Newbie

                thank you very much, now my connection is ok by entering the user as appuser and not as a Manager user.Now I have another problem but will also be another thread 

                 

                thanks again.

                • 5. Re: Using stomp.js with jboss-eap-6.1.0.Alpha
                  Clebert Suconic Master

                  Howard just fixed the JIRA