MQTT API, WebSockets

Hi!

I’m mobile app developer (not native, HTML5 hybrid app, based on IonicFramework) and I develop IoT Manager mobile app based on exchange data between any devices and MQTT brokers (discuss about this app on ESP8266.com).
All hybrid app, based on WebView, can’t establish TCP/IP connections to brokers standart port 1883 via mqtt protocol (mqtt://), but support connections to brokers via WebSockets (ws:// and wss://).
Reconfigure broker for supporting WebSockets very simplest, just add several lines to .conf file.
Can you add supporting WebSockets API for thethingsnetwork MQTT broker?

Tnx!

2 Likes

+1 request for WebSockets support.

I’m also looking into using WebSockets (something like the JavaScript library Paho) to retrieve new MQTT messages dynamically.

Would it be possible to support this on TheThingsNetwork MQTT broker? WebSockets are supported on Mosquitto 1.4.5.

Paho hosts a simple utility to debug WebSockets for a broker.

Regards
Hans Henrik

for who wants to play with websockets … I have a mosquitto to websocket proxy listening at ws://vme-1.automation-du.de:80/mosquitto - feel free to give it a go.

ps: use a random client-id multiple sessions with the same id will not work.

2 Likes

@w4e. Very cool

I’m using cloudmqtt.com. You can set a bridge and have some connections. A simple plan is free to use :smiley:

This is a great idea, but I wouldn’t recommend accepting websocket connections directly on the TNN MQTT brokers. Those are needed to route core network backend and if a popular web-site started to overload it with Websocket requests, wouldn’t be good.

Putting a proxy or something in the middle to handle that client-load and keep it separated from the core network would be best IMO. But like others mentioned, it’s not too hard to spin up an AWS or DigitalOcean VM and just put an websocket-to-MQTT gateway for your websocket users.

2 Likes

Realy good point, never connect a website to it. Didnt thought about that. But a free solution is the cloudmqtt Bridge without touching your ec2 you can connect with a websocket for free… cloudmqtt its on mosquitto

Would it be possible to document exactly what you did to get the bridge working?

@egon

Yes. I did here

https://github.com/zoutepopcorn/ttn_tools/blob/master/README.md

1 Like

Great tool @popcorn . By this tool can I get data to build an IOS mobile app ?