eclipse / paho.mqtt.javascript

paho.mqtt.javascript
Other
1.15k stars 467 forks source link

TCP Support #140

Open boneskull opened 6 years ago

boneskull commented 6 years ago

Related to #88 and maybe other issues.

@icraggs Mentions the client should also support TCP sockets in addition to WebSockets.

This is "less important" than #139.

ameinhardt commented 6 years ago

my pull request https://github.com/eclipse/paho.mqtt.javascript/pull/158 supports tcp/tls (for chrome app). I this issue is about tcp for node? Maybe that would result in one paho.js build for web, another for node.js?

faisalbudiman commented 5 years ago

i want to connecting to tcp://myurl:1884 but console show an error mqttws31.js:979 Uncaught DOMException: Failed to construct 'WebSocket': The URL 'ws://[tcp://mchat.mindwave.my]:1884/mqtt' is invalid. at ClientImpl.Paho.MQTT.ClientImpl._doConnect (http://localhost/chatsapp/Website/Client/chatweb/assets/js/mqttws31.js:979:18) at ClientImpl.Paho.MQTT.ClientImpl.connect (http://localhost/chatsapp/Website/Client/chatweb/assets/js/mqttws31.js:849:9) at Client.connect (http://localhost/chatsapp/Website/Client/chatweb/assets/js/mqttws31.js:1799:11) at http://localhost/chatsapp/Website/Client/chatweb/assets/js/app.js:303:10

this is my code for connecting

function MQTTconnect() { var token; var uname = "mindwave"; var pwd = "mindwave"; $.ajax({ url : "app/controller/getSession.php", success : function(session){ var temp = session.split("#"); token = temp[0]; } }) setTimeout(function(){ console.log("connecting to "+ host +" "+ port); mqtt = new Paho.MQTT.Client(host,port,token); var options = { timeout: 3, onSuccess: onConnect, onFailure: onFailure, userName : uname, password : pwd }; mqtt.onConnectionLost = onConnectionLost; mqtt.onMessageArrived = onMessageArrived; mqtt.onConnected = onConnected; mqtt.connect(options); //connect $("#status").val("Connecting..."); },3000); return false; } anyone can help me please ?