Just to close the loop, the subprotocol name used by the library is *mqtt *for v3.1.1
Regards 2016-08-10 9:35 GMT+02:00 Luca Capra <luca.ca...@gmail.com>: > Hi Martyn, > thank you, indeed I corrected the client code (I exported the wrong code > with some paramters experiments) > > I prepared a running example here (output is all in the browser console) > > - This run the 1.3.0 version > http://46.101.120.189/?url=mqtt://api.raptorbox.eu:1883 > > - This runs 1.4 snapshot from my pc > http://46.101.120.189/?url=mqtt://localhost:1883 > > > On the client side I get such error > Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' > header but no response was received > > and both of them refuse to connect with the same notice on artemis side > Requested subprotocol(s) not supported: mqttv3.1 > > I noticed the library actually set the subprotocol as a constant here for > broser connections: > https://github.com/mqttjs/MQTT.js/blob/master/lib/connect/ws.js#L78 > > so it may be a library issue / decision. > > What I cannot get is to use MQTT as subprotocol modifying the above > constant to something meaningful for artemis. > > Best > Luca > > 2016-08-09 16:30 GMT+02:00 Martyn Taylor <mtay...@redhat.com>: > >> Hi Luca, >> >> The feature is supported. The issue was how you were configuring your >> client. >> >> There are two versions of MQTT that are supported in Artemis: 3.1 and >> 3.1.1. In 3.1.1 the protocol handshake (or ID), the first couple of bytes >> sent by the client changed. So, you must specify the corresponding >> version >> and protocol ID in your client. >> >> // For MQTT 3.1.1 this is >> protocolId: "MQTT" >> protocolVersion: 4 >> >> or >> >> // For MQTT 3.1 - old version >> protocolId: MQIsdp >> protocolVersion: 3 >> >> The issue was that your client was specifying: >> >> protocolId: MQTT >> protocolVersion: 3 >> >> This does not match any protocol, hence the error you are seeing. >> >> I modified your javascript to configure your client like below and it >> worked for me. >> >> var client = mqtt.connect('ws://localhost:1883', { >> protocolId: 'MQTT' >> , protocolVersion: 4 >> }); >> >> Can you update accordingly and let me know if it works. >> >> Thanks >> Martyn >> >> On Tue, Aug 9, 2016 at 3:11 PM, Luca Capra <luca.ca...@gmail.com> wrote: >> >> > Hi Martyn, all >> > >> > sorry for taking on from such an old thread, but as of today with >> > 1.4-SNAPSHOT I've not been able to have MQTT over websocket to work >> > >> > I continue to receive a debug notice like this >> > >> > - Requested subprotocol(s) not supported: MQTT >> > - Requested subprotocol(s) not supported: mqttv3.1.1 >> > - Requested subprotocol(s) not supported: mqtt >> > - ... many other tentatives >> > >> > Is it the subprotcol name that is not matching or is this feature >> actually >> > not supported? >> > >> > I'm trying to have the broker to talk from a web browser to the broker >> and >> > still mqtt over ws seems the best way. >> > Do you have any suggestion ? >> > >> > Thank you! >> > >> > >> > >> > 2016-05-31 18:50 GMT+02:00 Martyn Taylor <mtay...@redhat.com>: >> > >> > > Hi Luca, >> > > >> > > You are seeing the error because you are not setting the correct >> version >> > > and protocol header in your client. Your client should set: >> > > >> > > ProtocolID="MQTT" and ProtocolVersion=4 // 3.1.1 >> > > or >> > > ProtocolID="MQlsdp" and ProtocolVersion=3 // 3,1 >> > > >> > > Artemis will accept both protocol versions (which are practically >> > > identical) but both point to the 3.1.1 implementation. Your mileage >> may >> > > vary with 3.1. I suggest always using 3.1.1. >> > > >> > > line 15853 of your js should be: >> > > >> > > var client = mqtt.connect('ws://localhost:1883', { >> > > protocolId: 'MQTT >> > > , protocolVersion: 4 >> > > }); >> > > >> > > Instead of: >> > > >> > > var client = mqtt.connect('ws://localhost:1883', { >> > > protocolId: 'MQTT' // or 'MQIsdp' in MQTT 3.1.1 >> > > , protocolVersion: 4 // or 3 in MQTT 3.1 >> > > }); // you add a ws:// url here >> > > >> > > Note the protocol ID in 3.1.1 is "MQTT". >> > > >> > > I made these changes locally and it works fine for me. >> > > >> > > Thanks >> > > Martyn >> > > >> > > On Tue, May 31, 2016 at 2:04 PM, Luca Capra <luca.ca...@gmail.com> >> > wrote: >> > > >> > > > Hi, >> > > > >> > > > I tried to setup the mqttjs library and run it in a browser. >> > > > Unfortunately, it tries to connect over websocket and artemis cannot >> > > > recognize the subprotocol >> > > > >> > > > The source is here: http://pastebin.com/Jgeijbz9 >> > > > >> > > > [Thread-10 (activemq-netty-threads-2076099910)] [DEBUG] >> > > > io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker - >> > [id: >> > > > 0x8958b0d5, /127.0.0.1:60138 => /127.0.0.1:1883] WebSocket version >> V13 >> > > > server handshake >> > > > [Thread-10 (activemq-netty-threads-2076099910)] [DEBUG] >> > > > io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker - >> > > > WebSocket version 13 server handshake key: pJTCBulMMJvyCoIpj2wEPg==, >> > > > response: 6vRlkIXEqz7ihckJ2TFuB6V9uhY= >> > > > [Thread-10 (activemq-netty-threads-2076099910)] [DEBUG] >> > > > io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker - >> > > > Requested subprotocol(s) not supported: mqttv3.1 >> > > > >> > > > >> > > > In the latest master the issue with the client disconnecting is >> still >> > > > there, but the error message is slightly different. In 1.2 it used >> to >> > > work >> > > > >> > > > [Thread-3 (activemq-netty-threads-2076099910)] [DEBUG] >> > > > io.netty.util.internal.JavassistTypeParameterMatcherGenerator - >> > > Generated: >> > > > >> > > > io.netty.util.internal.__matchers__.io.netty.handler. >> > > codec.mqtt.MqttMessageMatcher >> > > > [Thread-3 (activemq-netty-threads-2076099910)] [DEBUG] >> > > > org.apache.activemq.artemis.core.protocol.mqtt - SESSION CREATED: >> > > > d2cd94e9-3d23-4a85-bb53-53528cd9fcb1 >> > > > [Thread-3 (activemq-netty-threads-2076099910)] [DEBUG] >> > > > org.apache.activemq.artemis.core.protocol.mqtt - Bad Message >> > > Disconnecting >> > > > Client >> > > > >> > > > >> > > > Thank you >> > > > >> > > > Regards >> > > > Luca >> > > > >> > > > >> > > > 2016-05-27 13:25 GMT+02:00 Luca Capra <luca.ca...@gmail.com>: >> > > > >> > > > > Hi Martyn, >> > > > > I will bundle the js all in a page for testing. >> > > > > >> > > > > I think the js library will try to interact with "mqtt over >> > websockets" >> > > > > from the browser. >> > > > > (See just one line above here, >> > > > > https://github.com/mqttjs/MQTT.js#contributing) >> > > > > >> > > > > Is it supposed to work in Artemis? (.. Nice feature btw!) >> > > > > >> > > > > I can either provide you the client wrapped in docker or vagrant >> vm >> > if >> > > it >> > > > > works for you. >> > > > > >> > > > > Thanks >> > > > > Luca >> > > > > >> > > > > >> > > > > 2016-05-27 11:56 GMT+02:00 Martyn Taylor <mtay...@redhat.com>: >> > > > > >> > > > >> Hi Luca, >> > > > >> >> > > > >> I had a play around with the JS you supplied but didn't get it >> > > working. >> > > > >> Any chance you could browsify the test so I can run it without >> > having >> > > a >> > > > >> NodeJS environment set up, (A bash script would do if that's >> > > > possible). I >> > > > >> just need to see the issue in the broker. >> > > > >> >> > > > >> Thanks >> > > > >> >> > > > >> On Thu, May 26, 2016 at 10:18 AM, Luca Capra < >> luca.ca...@gmail.com> >> > > > >> wrote: >> > > > >> >> > > > >> > Ok, I will double check on the client side. >> > > > >> > >> > > > >> > >> > > > >> > If you have the time, here the test case >> > > > >> > >> > > > >> > The nodejs client code >> > > > >> > https://gist.github.com/muka/b6374610618978948f39d83e5248ff7e >> > > > >> > >> > > > >> > The broker implementation (raptor-broker) is here (branch >> artemis) >> > > > >> > >> > > > >> > https://github.com/muka/raptor/tree/artemis >> > > > >> > >> > > > >> > To run it should just require to mvn install and run the >> > mainClass. >> > > It >> > > > >> > requires artemis modules of 1.3-SNAPSHOT in the local >> repository.. >> > > I'm >> > > > >> > pretty sure you have them already :) >> > > > >> > >> > > > >> > It tries to load configurations (avail in repository ./config) >> > from >> > > > >> > /etc/raptor or from system property -DconfigDir=<path> >> > > > >> > >> > > > >> > Thank you for the precious help! >> > > > >> > >> > > > >> > Regards >> > > > >> > Luca >> > > > >> > >> > > > >> > >> > > > >> > 2016-05-26 10:42 GMT+02:00 Martyn Taylor <mtay...@redhat.com>: >> > > > >> > >> > > > >> > > Hi Luca, >> > > > >> > > >> > > > >> > > Only 3.1.1 is supported in Artemis. We've not tested against >> > > older >> > > > >> > > versions. Could you ensure you are setting the version >> properly >> > > in >> > > > >> your >> > > > >> > > client. >> > > > >> > > >> > > > >> > > Error processing control packet usually means the client is >> > doing >> > > > >> > something >> > > > >> > > wrong. If you send me your test case / reproducer, I will >> take >> > a >> > > > >> look. >> > > > >> > > >> > > > >> > > Thanks >> > > > >> > > Martyn >> > > > >> > > >> > > > >> > > On Thu, May 26, 2016 at 9:06 AM, Luca Capra < >> > luca.ca...@gmail.com >> > > > >> > > > >> > wrote: >> > > > >> > > >> > > > >> > > > Hi Martyn, >> > > > >> > > > thank you for your feedback! >> > > > >> > > > >> > > > >> > > > I had in fact two different acceptor on my broker.xml. I'm >> now >> > > > using >> > > > >> > just >> > > > >> > > > one now. I've also moved to latest master 1.3-SNAPSHOT from >> > git >> > > > >> > > > >> > > > >> > > > I noticed I get this exception now on connection via mqtt >> > > > >> > > > >> > > > >> > > > WARN: Error processing Control Packet, Disconnecting >> Client2 >> > > > >> > > > >> > > > >> > > > From the debugger I can see it is an >> ArrayOutOfBoundException >> > > > which >> > > > >> > > happens >> > > > >> > > > somewhere around ctx.flush() in MqttProtocolHandler. >> > sendConnack >> > > > >> > > > >> > > > >> > > > The client is mqttjs a nodejs based module implementing 3 >> -> >> > > 3.1.1 >> > > > >> mqtt >> > > > >> > > > version >> > > > >> > > > >> > > > >> > > > I'm using a custom SecurityManager, but should not be at >> the >> > > cause >> > > > >> of >> > > > >> > > such >> > > > >> > > > issue >> > > > >> > > > >> > > > >> > > > Need to investigate better >> > > > >> > > > >> > > > >> > > > Best >> > > > >> > > > Luca >> > > > >> > > > >> > > > >> > > > 2016-05-25 21:40 GMT+02:00 Martyn Taylor < >> mtay...@redhat.com >> > >: >> > > > >> > > > >> > > > >> > > > > Hi Luca, >> > > > >> > > > > >> > > > >> > > > > You don't need any specific configuration to do this. >> You >> > can >> > > > >> just >> > > > >> > set >> > > > >> > > > up >> > > > >> > > > > a MQTT Client and a STOMP client and start >> sending/receiving >> > > > from >> > > > >> the >> > > > >> > > > same >> > > > >> > > > > address. >> > > > >> > > > > >> > > > >> > > > > There are a couple of issues with Artemis versions >> <=1.2.0. >> > > > I've >> > > > >> > fixed >> > > > >> > > > > these issues on master and will be doing a 1.3.0 release >> > very >> > > > >> soon, >> > > > >> > it >> > > > >> > > > > should be available in the next week or so, your best >> bet is >> > > to >> > > > >> wait >> > > > >> > > for >> > > > >> > > > > this. >> > > > >> > > > > >> > > > >> > > > > I've also added a simple test to that shows this working. >> > > See: >> > > > >> > > > > >> > > > >> > > > > >> > > > >> > > > >> > > > >> > > >> > > > >> > >> > > > >> >> > > > https://github.com/apache/activemq-artemis/pull/543/commits/ >> > > 62d284d7765218ced2d0f441cf26ffaaaf3c26f2 >> > > > >> > > > > >> > > > >> > > > > Thanks >> > > > >> > > > > Martyn >> > > > >> > > > > >> > > > >> > > > > >> > > > >> > > > > On Wed, May 25, 2016 at 3:58 PM, Luca Capra < >> > > > luca.ca...@gmail.com >> > > > >> > >> > > > >> > > > wrote: >> > > > >> > > > > >> > > > >> > > > > > Hi all, >> > > > >> > > > > > on a project I'm working on I've switched from Apollo >> to >> > > > >> Artemis. >> > > > >> > > > > > >> > > > >> > > > > > I'm running Artemis as an embed server and would like >> to >> > > have >> > > > >> > > > > > inter-protocol communication between stomp and mqtt. >> > > > >> > > > > > >> > > > >> > > > > > What I'm missing is if this can be done from >> configuration >> > > or >> > > > >> > > creating >> > > > >> > > > an >> > > > >> > > > > > mqtt and stomp client each one to deliver messages the >> > other >> > > > >> one. >> > > > >> > > > > > >> > > > >> > > > > > Thank you >> > > > >> > > > > > Luca >> > > > >> > > > > > >> > > > >> > > > > >> > > > >> > > > >> > > > >> > > >> > > > >> > >> > > > >> >> > > > > >> > > > > >> > > > >> > > >> > >> > >