-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Centrifugo v4 roadmap #500
Comments
One more possible addition in terms of Protocol V2 is Centrifugo own bidirectional emulation layer. It may allow removing SockJS in most cases I believe. And get rid of sticky sessions for fallback transports. Client API may look like this: const transports = [
{
transport: 'websocket',
endpoint: 'ws://example.com/connection/websocket'
},
{
transport: 'http_stream',
endpoint: 'http://example.com/connection/http_stream'
},
{
transport: 'sse',
endpoint: 'http://example.com/connection/sse'
},
];
const centrifuge = new Centrifuge(transports, {protocolVersion: 'v2'}); This is mostly useful for browser only. For mobile clients we will only support our main WebSocket transport. Centrifuge-js may try transports in order on the first handshake. So most users will be connected to WebSocket and some to HTTP-based fallback transports which work over built-in emulation layer (similar way to SockJS but without SockJS involved at all, and no real need to use sticky sessions in cluster mode). |
Hello! It's me again. Here are my ideas:
|
@matpuk thanks for suggestions. Could you elaborate more on both ideas – extend them with examples and desired API/configuration changes? I think both can be implemented even as part of Centrifugo v3. I think I mostly understood 1 – but more real-life examples with real endpoints/iss will help. |
Hi, @FZambia. Let's start with point 2. Centrifugo v3 has cool feature - possibility to attach private metadata to a connection from connection proxy. But in case of JWT, the proxy is not called. The only way to use 'meta' property is to put it inside JWT token, so Centrifugo will pass it to other proxies. And here go problems. For example, I have 'tenantID' property in my JWT token and want to know it in subscription proxy. For this I'm forced to duplicate this property in my JWT token:
And for every additional JWT token data I want to have access in my proxies, I need to duplicate it inside 'meta'. There are two possible solutions for this problem:
|
@matpuk I see. What I think:
If you can afford working this way then theoretically you can set token to connection custom data (sent from client in first request and proxied to the backend). Then you need to validate JWT yourself on the backend side in proxy request handler. And after authenticating attach required metadata to the connection. Though I understand this can be not very handy especially since you are already relying on Centrifugo to validate tokens, using JWKS, etc.
In general, seems reasonable to have (especially since we already support proxying custom headers) – just need to think on accurate implementation. Can't say any ETAs for this at the moment - could you plz open a separate issue? |
I'm thinking to go this way, but there is a drawback - I will be forced to implement connection attempts throttling and invalid connections discarding in my backend's python code instead of leaving this to fast Go-implemented Centrifugo 😞
Done. |
Some updates about v4 progress. Given the huge amount of work we decided to choose a bit simpler plan:
I started a doc about upcoming client API standartization (which should be part of Centrifugo v4). It's here: Client API v2 description - this is a page on v4 WIP docs. Expect changes in it since I'd like to validate this with interested parties, and feel free to ask if sth needs clarification. At this point we have branches in all client SDKs which are close to this spec. |
Option |
Updated issue description to mention work on #507 in Centrifugo v4 |
Opened a PR #519 with changes for Centrifugo v4 |
For those interested in trying out new SDK API - it's already possible to try using SDK from a branch where we support client protocol v2 and adding URL parameter PRs in SDK from branches with new protocol and API support:
Don't hesitate to ask any question in our community rooms. |
Centrifugo v4.0.0 beta.1 just released. Also, Obviously, these releases are not for production usage, and some changes can still happen. Please reach out in community chat if you want to try beta release but came across questions/issues - highly appreciate the feedback. |
Centrifugo v4 released. |
Soon after Centrifugo v3 we are starting to think about v4 release. Let's look at v4 plans.
New client protocol adoption
More human-readable JSON, one-shot encode/decode (more performance), simpler introspection if required. The work already started in #499. Note that possibility to try (switch to) client protocol v2 will appear in Centrifugo v3 (possibly in v3.2.0), in v4 the plan is to make new protocol version default.
Standartization of client SDK API
All client SDKs will work according to a common spec. There is a prototype of if in Centrifugo v4 WIP docs.
Application-level pings
Protocol V2 may have a new approach to client-server pings. Pings will be sent on application protocol level, clients won't send pings to server at all – the will be able to rely on server heartbeats to understand that connection is still active. This may help to reduce CPU usage since less ping/pong frames will travel around. Also, this will unify format of pings throughout our unidirectional transports (uni Websocket, Eventsource (SSE), uni http streaming).
Disconnects: expose code to client disconnect handler and remove JSON from reason
This will allow handling disconnect codes in a custom way. Will add some performance, readability, WebTransport interop. This is also part of client protocol v2 and details can be found in #499.
Better channel security model
public
boolean channel option and removeprotected
option - namespaces will inheritprotected
option behavior by default). This should resolve some confusion about current channel behavior, for example when channels sent in JWT users often think that nobody else will be able to subscribe on them. While this is not true tillprotected
option is not enabled in namespace.Removing usage of $ prefix to mark private channel
See #507 for motivation and details.
Faster Redis engine
Redis engine based on https://github.com/go-redis/redis should provide more perf and reduce dependencies. Additional details: centrifugal/centrifuge#210. This is not really required to be part of Centrifugo v4 - this may come in v3 or soon after v4 release. But I think it's important to mention. The work is pretty big and not really trivial but may be worth it.
When Centrifugo v4 will be released?
For Centrifugo v3 we had strict deadline right from the announce post. For v4 there is no deadline defined yet. This post will be updated as soon as things will evolve.
If anyone is interested to discuss these changes and maybe adjust them somehow at an early stage – feel free to reach out.
The text was updated successfully, but these errors were encountered: