Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9392

Add ability to pass parameters within websocket url and handle them in onOpen event

    XMLWordPrintableJSON

Details

    • Novice

    Description

      To give more dynamic for my app I need to send some additional information at the moment client connect to server through websocket.

      So the URL will be like :
      ws://localhost:" + PORT + "/hola1?param1=value1&param2=value2

      There is no limit of parameters for that moment of time.

      To use this parameters : they will be added to header as key/value and send with onOpen event.

      Solution:
      1) create map when service method is called at WebsocketConsumer such as this.queryMap = getQueryMap(request.getQueryString());

      2) add them to header when sendEventNotification triggered :
      for (Map.Entry<String, String> param : queryMap.entrySet())

      { exchange.getIn().setHeader(param.getKey(), param.getValue()); }

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            pkletsko Pavlo Kletsko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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