Open mohammadshrahi opened 4 years ago
Apologies for the late reply. Can you elaborate more on your particular use-case? For web applications you would typically connect to amqp from your backend and use some sort of push mechanism (e.g. websockets) to talk to the front-end.
First, thanks for an awesome lib!
I'm also looking for web support. My use case is that I have an app that I like for Android, iOS and web. While your suggestion for websocket would work it does make the architecture a bit more complex since now I will have platform dependent code and need to add that functionality to my backend. If there was web support for AMQP I could have the same architecture for all of the three client platforms. Which is one of the core things you want when making apps in flutter IMO.
Note that I'm not really a web developer, only worked a lot with Android before, so I might have missed some important aspect here.
But it would be awesome to get web support for this library!
Is there any change about this issue? I also encountered with the same problem. I want to know whether there is an easy way to connect to rabbitmq in flutter web without any backend. Do you still think not to add web support @achilleasa ? If you found any solution, can you share @mohammadshrahi , @hettan ?
AFAICT the main issue (as you can see here) that prevents it from running on the web is the dart:io
import. However, the universal_io package might be a drop-in replacement that could make this work in a browser.
As I am not familiar with using Dart on the web, can you provide me with a mimimal test app that I can use to verify that it actually works?
AFAICT the main issue (as you can see here) that prevents it from running on the web is the
dart:io
import. However, the universal_io package might be a drop-in replacement that could make this work in a browser.As I am not familiar with using Dart on the web, can you provide me with a mimimal test app that I can use to verify that it actually works?
Hi I tried that (replacing import (dart.io -> universal_io) according here)
The API is exactly the same API as dart:io. You can simply replace dart:io imports with package:universal_io/io.dart. Normal dart:io will continue to be used when your application runs in non-Javascript platforms
It works on linux but not on Web (chrome) and according this issue its because socket is not allowed in browsers.
So the only way to make it work on web is implementing this with WebSocket.
Hello any updates on this?
Hey. There's no direct implementation of the AMQP protocol over HTTP. This is for example why there's no proper AMQP client in JS for browsers.
In browsers, usually protocols like MQTT and STOMP are used in such cases. RabbitMQ has built-in plugins that enable these protocols, usually over websockets.
Since this package is an AMQP implementation in Dart, it would be out of its scope to implement any other protocol.
The mqtt_client and stomp_dart_client should be suitable for the web.
Simply put: I should go look for mqtt_client or stomp_dart_client. Understood. Thank you for your feedback!
That is my personal opinion and recommendation 🙂I cannot speak for the package’s developer of course.
From: Stephane SEGNING LAMBOU @.> Sent: Sunday, July 23, 2023 3:45:36 PM To: achilleasa/dart_amqp @.> Cc: Boaz Amit Danhi @.>; Comment @.> Subject: Re: [achilleasa/dart_amqp] web pltform (#38)
Simply put: I should go look for mqtt_client or stomp_dart_client. Understood. Thank you for your feedback!
— Reply to this email directly, view it on GitHubhttps://github.com/achilleasa/dart_amqp/issues/38#issuecomment-1646844506, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA35ME5GLKFTHDKML4MJHKLXRUTIBANCNFSM4KLLGSMA. You are receiving this because you commented.Message ID: @.***>
RabbitMQ and Azure Service Bus both support AMQP over websockets. Implementing the choice between socket and websocket would open this up to web users.
As mentioned above, supporting websockets requires to implement the STOMP protocol which is fundamentally different than the AMQP binary protocol that this client implements.
However, it might be possible to tweak the underlying socket implementation to use a Websocket to TCP bridge like https://github.com/cloudamqp/websocket-tcp-relay. Note that in this case, you would still need to host the relay somewhere and provide a TLS certificate to secure the connection.
If folks find this use-case interesting, I will allocate some time to work on it.
RabbitMQ and Azure Service Bus both support AMQP over websockets. Implementing the choice between socket and websocket would open this up to web users.
Apologies - it is AMQP 1.0 that has built-in support for websockets and not v0.91. My mistake.
hello,i was trying this package on mobile platforms (android /ios) and it's work fine. but what about web. I think add web support it's will be a big contribution