xHasKx / luamqtt

luamqtt - Pure-lua MQTT v3.1.1 and v5.0 client
https://xhaskx.github.io/luamqtt/
MIT License
160 stars 42 forks source link

mqtt over websocket #33

Closed kafura-kafiri closed 3 years ago

kafura-kafiri commented 3 years ago

hello, salam, is it possible to make a mqtt connection between browser and lua over websocket

xHasKx commented 3 years ago

Hello, are you intended to run Lua in the browser? There is a way to create websockets connector by yourself: https://github.com/xhaskx/luamqtt#connectors

kafura-kafiri commented 3 years ago

Tnx for your reply, i have a react app on browser which only can connect to mqtt on websocket, then on openwrt for server side i only can run lua and i want to connect it to mqtt with websocket protocol. so what is the best answer and practice

xHasKx commented 3 years ago

If I understand you correct, you have a MQTT broker somewhere accepting connections over websocket protocol, for your react app, and you intended to use the same endpoint to connect openwrt device with luamqtt onboard to the same broker? In this case the simplest way for you will be to configure additional endpoint on you broker to listen plain mqtt connections, not over websocket.

kafura-kafiri commented 3 years ago

Tnx a Lot, you have made my day