Skip to content
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

web pltform #38

Open
mohammadshrahi opened this issue Jan 24, 2020 · 12 comments
Open

web pltform #38

mohammadshrahi opened this issue Jan 24, 2020 · 12 comments

Comments

@mohammadshrahi
Copy link

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

@achilleasa
Copy link
Owner

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.

@hettan
Copy link

hettan commented Apr 24, 2020

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!

@bahricanyesil
Copy link

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 ?

@achilleasa
Copy link
Owner

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?

@ali77gh
Copy link

ali77gh commented Oct 30, 2021

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.

@stephane-segning
Copy link

Hello any updates on this?

@boaz-amit
Copy link
Contributor

boaz-amit commented Jul 22, 2023

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.

@stephane-segning
Copy link

Simply put: I should go look for mqtt_client or stomp_dart_client. Understood. Thank you for your feedback!

@boaz-amit
Copy link
Contributor

boaz-amit commented Jul 23, 2023 via email

@JerichoCross
Copy link

RabbitMQ and Azure Service Bus both support AMQP over websockets. Implementing the choice between socket and websocket would open this up to web users.

@achilleasa
Copy link
Owner

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.

@JerichoCross
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants