-
Notifications
You must be signed in to change notification settings - Fork 467
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
Inject URL in MQTTWebsocketTransport #433
Comments
I'll answer my question in case anyone else wants to do this. The solution is to sign the URL with SigV4 as described here. The next problem is to be able to provide the URL to MQTTWebsocketTransport, rather than let MQTTWebsocketTransport construct the url itself. That was accomplished with the following subclass.
I'd be happy to contribute the SigV4 code if you think it makes sense in this framework. |
Hi @lagnat. Thanks for this. I think it makes sense that you are able to provide custom url instead of framework constructing it for you. |
So for now, I would suggest to only implement this so you don't need your custom subclass. For SigV4 part I would rather leave it out to avoid additional complexity, but it would be nice to document it if someone else needs it. |
@lagnat how did you inject this URL to WSSTransport layer after subclassing? |
More or less like this:
|
Hi @lagnat I need to MQTTWebsocketIoTTransport class. Can you help me ? I have a presigned url and I can't use it. |
Which part do you have problem with? |
Check this : #458 |
It doesn't seem like you have created subclass? |
Yes I created subclass but I don't sure it is true.
|
I suspect your problem is the name of your endPointUrl function. It should be endpointURL, but I don't know swift so I might be wrong about how it bridges. |
Yes, Swift will as well require you to add override in front of function. |
MQTTWebsocketTransport object doesn't contains endpointURL function. You can check from source code: https://github.com/novastone-media/MQTT-Client-Framework/blob/fad0943ddc1c96b5cecc68314f540ac1097b870e/MQTTClient/MQTTClient/MQTTWebsocketTransport/MQTTWebsocketTransport.h . I don't know. It should not be that hard. I only want connect aws presigned url with this library : #458 . By the way, I'm using Eclipse Paho library in Android side and It works fine. |
Thank you now I edited subsclass as below :
Then I tried to connect :
|
@yusufonderd did subclassing actually call your |
@mendirattanishant You are right. endPointURL method never called. |
I think this might be due to Swift bridging. |
I am not sure what is best solution for this but it seems like a lot of people have this issues. So as a temporary workaround I would suggest that we introduce PR with this would be appreciated. |
@mendirattanishant could you create a PR? Instead of commenting out code, I think we just need to check if url is set, otherwise logic stays the same. |
@jcavar Yes, I am working on creating a PR for this. |
Nice, thank you! |
@mendirattanishant I tried your solution but it doesn't change anything. Same logs:
|
@yusufonderd |
Yes my url is signed url and contains '/mqtt' path. I successfully connecting android side with same url. |
I've been working on the same problem for two weeks. Do you have any idea ? |
It is hard to say without more info, if you could debug and find more details then it might be more clear. |
@yusufonderd It worked for me after I provided my own url. Please provide more logs for a better clarity. |
@nmendiratta Do you use aws presigned url ? I will give more detail about problem. But first I have a question. Is anybody use to aws presigned url with this library ?
|
@yusufonderd I use the same pre signed url like |
Hi @mendirattanishant thank you for your patient. Now I successfully connected websocket. But I cannot subscribe topic #466 |
@mendirattanishant Now I applied your changes again. I'm getting this exception. Any idea for this ?
|
@yusufonderd please check if your url is correct.
|
I will close this issue now, we now have support for custom URL. Please open separate issue if you still have it with specific details about it. |
I imagine I might have to provide an Authorization header or supply the signature in the URL. It this known to work or not work?
The text was updated successfully, but these errors were encountered: