liftbridge-io / liftbridge

Lightweight, fault-tolerant message streams.
https://liftbridge.io
Apache License 2.0
2.57k stars 106 forks source link

WebSockets or socket.io interface #152

Open oliverhausler opened 4 years ago

oliverhausler commented 4 years ago

Just like NATS, Liftbridge only offers a gRPC interface. gRPC is great for servers but doesn't work inside browsers, so I would consider a second WebSockets or socket.io interface as extremely useful.

Right now, to use NATS/Liftbridge from a browser directly, a proxy is required.

gedw99 commented 4 years ago

Grpc does work. Grpc gateway proxy server based on nginx or the golang grpc gateway.

This gateway is the standard approach to this problem.

But I am not super familiar with the exact message pattern semantics that liftbridge client should enforce. Web grpc can't do bidirectional steaming for example but that's rarely needed.

Maybe someone else can offer advice about that aspect

oliverhausler commented 4 years ago

Does this solve the problem? It solves the proxy on the server, so that NATS/liftbridge isn't exposed on the internet, but the client problem is a different one: Web browsers only allow outgoing http(s) traffic via JS. If I am not mistaken, there is no way to contact a grpc server directly. I found something interesting, though, which might work:

https://github.com/grpc/grpc-web

Still, it would be a lot easier if there was a direct way for connecting via socket.io, even though less performant, I believe performance would be better than running through proxies.

tsingson commented 4 years ago

a websocket server via liftbridge client as bridge to liftbridge/nats is work great. about 10K android apk ( websocket client ) connect to 5 websocket server.

websocket connect to gRPC should work, if message is not plain string , it need some data searilized / un-searilized.

winwisely99 commented 4 years ago

We got grpc golang and flutter web working using envoy and grpc gateway

Now seeing if liftbridge works through it for flutter web.

The advantage is that it's all pure grpc and it's codegen for client and server

joe-getcouragenow commented 4 years ago

You can run envoy without docker BTW on linux and mac. Not windows ( yet). https://www.getenvoy.io/

alexisread commented 2 years ago

Issue #375 opened for an MQTT bridge. This could allow for an embedded MQTT broker that handles websockets, for a browser connection