Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-5865

Enable "getRemoteAddress()" method in WebSocket Requests

    XMLWordPrintableJSON

Details

    • Important

    Description

      The method (getRemoteAddress()) in class "org.apache.activemq.transport.ws.AbstractStompSocket" does not return the correct address; it returns always ""StompSocket_" + hashCode();"

      We need the correct address (e.g. "wss://127.0.0.1:63114") for our use case.

      The implementation whould be very simple.
      In class "org.apache.activemq.transport.ws.jetty8.WSServlet" (and also in jetty9 package) pass the address during creation of class StompSocket in the same package:

      String scheme = request.getScheme();
      if ("http".equalsIgnoreCase(scheme)) {
      scheme = "ws";
      } else if ("https".equalsIgnoreCase(scheme))

      { scheme = "wss"; }

      WebSocket socket = new CustomStompSocket(scheme + "://" + request.getRemoteAddr() + ":" + request.getRemotePort());

      It meight be that MQTT is also affected; a fix should be done by the same way.

      Attachments

        1. CustomStompSocket.java
          0.3 kB
          Christian Kemper
        2. CustomWebSocketServlet.java
          2 kB
          Christian Kemper

        Activity

          People

            tabish Timothy A. Bish
            xgadkem Christian Kemper
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified