-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket/mqtt - feasible? #17
Comments
Hi @mhaberler, I believe it is posible, let me get you the keys:
void ReaderMqttPacket::readMqttPacket(WiFiClient client){ 1ª auxBuffer = First read all data from client, to extract WebSocket packet from tcp/ip buffer, mqtt packet is contained in WebSocket packet. 2ª mqttPacketBuffer = extract mqtt packet from auxBuffer. 3ª now replace calls to client.ReadBytes() and client.read() with mqttPacketBuffer, simulating these functions, according to the original readMqttPacket(WiFiClient client) method:
// original method to adapt: // 2º reading and decoding remainingLengt of this mqtt packet from fixedHeader // 3ª reading remaining lengt bytes packet. Notice that you need to change ReaderMqttPacket::readRemainLengtSize(WiFiClient client) method to, changing client for mqttPacketBuffer. Lastly, change mqtt port from 1883 to 80 to listen webSockets connections, when you creating MqttBroker object. |
thanks I will give it a stab and report here, would appreciate if you can look over my shoulder any suggestions for the websockets part of the code? several libraries out there looking applicable this should become be a subclass of MqttBroker, right? -m |
I've taken an intermediate step: put a websockets-to-tcp proxy in front of the broker: https://github.com/mhaberler/EmbeddedMqttBroker-example/blob/websockets/src/example/main.cpp#L125 seems to work fine |
I was looking you example, I don't know ProxyWebSocketsServer.h, but I assume that it is similar to other web sockets libraries:
I will glad to know about your progress. |
do you see a way to make this code work over websockets so it's compatible with paho-mqtt js?
thanks in advance
Michael
The text was updated successfully, but these errors were encountered: