grpc-web
Centrifugo
Our great sponsors
grpc-web | Centrifugo | |
---|---|---|
33 | 31 | |
8,245 | 7,815 | |
1.2% | 1.5% | |
6.5 | 9.0 | |
21 days ago | about 23 hours ago | |
JavaScript | Go | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
grpc-web
-
Ask HN: WebSocket server transforming channel subscriptions to gRPC streams
* Additionally, client can stream data to the backend server (if bidirectional GRPC streams are used). I.e. client sends WebSocket messages, those will be transformed to GRPC messages by WebSocket server and delivered to the application backend.
As a result we have a system which allows to quickly create individual streams by using strict GRPC contract but terminating connections over WebSocket transport. So it works well in web browsers. After that no need to write WebSocket protocol, client implementation, handle WebSocket connection. This all will be solved by a suggested WebSocket server and its client SDKs.
The mechanics is similar to Websocketd (https://github.com/joewalnes/websocketd), but instead of creating OS processes we create GRPC streams. The difference from grpc-web (https://github.com/grpc/grpc-web) is that we provide streaming capabilities but not exposing GRPC contract to the client - just allowing to stream any data as payload (both binary and text) with some wrappers from our client SDKs side for managing subscriptions. I.e. it's not native GRPC streams on the client side - we expose just Connection/Subscription object to stream in both directions. GRPC streams used only for communication between WebSocket server and backend. To mention - grpc-web does not support all kinds of streaming now (https://github.com/grpc/grpc-web#streaming-support) while proposed solution can. This all should provide a cross-platform way to quickly write streaming apps due to client SDKs and language-agnostic nature of GRPC.
I personally see both pros and cons in this scheme (without concentrating on both too much here to keep the question short). I spent some time thinking about this myself, already have some working prototypes – but turned out need more opinions before moving forward with the idea and releasing this, kinda lost in doubts.
My main question - whether this seems interesting for someone here? Do you find this useful and see practical value?
-
Build and Deploy a gRPC-Web App Using Rust Tonic and React
By default, web browsers do not support gRPC, but we will use gRPC-web to make it possible.
-
Lemmy v0.18.0 Release - A reddit alternative written in Rust.
You just have to use a library implementation for JavaScript https://github.com/grpc/grpc-web
-
Full Stack Forays with Go and gRPC
TypeScript support remains an experimental feature of gRPC.
-
Introducing Tempo: low latency, cross-platform, end-to-end typesafe APIs
The gRPC-Web protocol supports HTTP/1 and can be used from a browser.
-
gRPC on the client side
-- grpc-web
-
gRPC vs REST: Comparing API Styles in Practice
Since we're using Envoy, there's one more neat trick that we can employ. It turns out that Envoy also support gRPC-Web out of the box, a JavaScript client designed to support gRPC communication from the browser! That means that we can send gRPC messages over HTTP/1.1 as base64 encoded strings or as binary protobufs. Messages will be sent through our proxy and on to our backend service. The advantage of this is smaller and more efficient wire communication which should lead to better performance.
-
Understanding gRPC Concepts, Use Cases & Best Practices
protoc-gen-grpc-web — a plugin that allows our front end to communicate with the backend using gRPC calls. A separate blog post on this coming up in the future.
-
Ask HN: Why isn't JSON-RPC more widely adopted?
Personally, find gRPC-Web very attractive but the current state of TypeScript/JS code-gen is very confusing and lacking.
I would love something like https://orval.dev for gRPC-web. Have I missed something or is it just early to expect it?
I tried a few libraries but couldn't get them to work or would generate unappealing results. I believe I'm hitting this issue with my local experiments. https://github.com/grpc/grpc-web/issues/535
-
You worked on it? Why is it slow then?
Seeing this I went right into the code and found the gem, grpc-web is responsible for browser support. Official Docs
Centrifugo
- Millions of Active WebSockets with Node.js
-
Show HN: DriftDB is an open source WebSocket back end for real-time apps
https://github.com/centrifugal/centrifugo
It's a complete solution, including server, admin panel and client library.
We're an European company and use OVH, Hetzner and others.
-
Laravel Websockets vs Soketi vs Laravel Echo Server
Hello! Theoretically you can take a look at https://github.com/centrifugal/centrifugo - which is a standalone self-hosted real-time messaging server. It does not have native support for Laravel and not compatible with Pusher protocol, though integrating with any backend system, including Laravel: see the blog post https://centrifugal.dev/blog/2021/12/14/laravel-multi-room-chat-tutorial, also has some helper packages:
-
What is the coolest Go open source projects you have seen?
Centrifugo https://centrifugal.dev/ https://github.com/centrifugal/centrifugo
- Golang updating the front-end with almost real-time events from the backend server
- Concurrency with Gin
-
Woe be onto you for using a WebSocket
Every time I read criticism of WebSockets it reminds me about WebSuckets (https://speakerdeck.com/3rdeden/websuckets) presentation :)
I am the author of Centrifugo server (https://github.com/centrifugal/centrifugo) - where the main protocol is WebSocket. Agree with many points in post – and if there is a chance to build sth without replacing stateless HTTP to persistent WebSocket (or EventSource, HTTP-streaming, raw TCP etc) – then definitely better to go without persistent connections.
But there are many tasks where WebSockets simply shine – by providing a better UX, providing a more interactive content, instant information/feedback. This is important to keep - even if underlying stack is complicated enough. Not every system need to scale to many machines (ex. multiplayer games with limited number of players), corporate apps not really struggle from massive reconnect scenarios, and so on. So WebSockets are definitely fine for certain scenarios IMO.
I described some problems with WebSockets Centrifugo solves in this blog post - https://centrifugal.dev/blog/2020/11/12/scaling-websocket. I don't want to say there are no problems, I want to say that WebSockets are fine in general and we can do some things to deal with things mentioned in the OP's post.
- Centrifugo – self-hosted real-time messaging server with bidirectional (WebSocket, SockJS) and unidirectional transports (Eventsource, HTTP-streaming, GRPC), JSON and Protobuf protocols, builtin scalability with PUB/SUB brokers, fully universal/language-agnostic.
-
Updating flutter app data from REST API in real-time
Install Centrifugo - https://github.com/centrifugal/centrifugo
-
Just another simple, fast, and resilient open-source WebSockets server. 📣
For those who looking into Laravel WebSockets replacement give a chance to https://github.com/centrifugal/centrifugo - it proved to help a lot dealing with WebSocket connections to backends built in languages without native/performant concurrency support. So you can continue writing business logic in Laravel, but let Centrifugo deal with persistent connection management and issue real-time updates over API.
What are some alternatives?
Socket.io - Realtime application framework (Node.JS server)
NATS - Golang client for NATS, the cloud native messaging system.
Confluent Kafka Golang Client - Confluent's Apache Kafka Golang client
Mercure - 🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
laravel-websockets - Websockets for Laravel. Done right.
ngx-grpc - Angular gRPC framework
grpc-over-webrtc - gRPC over WebRTC
Uniqush-Push - Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.
soketi - Next-gen, Pusher-compatible, open-source WebSockets server. Simple, fast, and resilient. 📣
Pusher - Ruby library for Pusher Channels HTTP API
grpcurl - Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
websocket - A fast, well-tested and widely used WebSocket implementation for Go.