Skip to content

Conversation

@WiktorStarczewski
Copy link
Contributor

No description provided.

@igamigo
Copy link
Collaborator

igamigo commented Dec 8, 2025

Is this mostly in relation to #1437? If so, would you mind outlining the changes that are required for this to work? Mainly looking to understand tradeoffs and see if we have any options (for instance, use a different store implementation for Node)

@WiktorStarczewski
Copy link
Contributor Author

WiktorStarczewski commented Dec 8, 2025

Is this mostly in relation to #1437? If so, would you mind outlining the changes that are required for this to work? Mainly looking to understand tradeoffs and see if we have any options (for instance, use a different store implementation for Node)

Yeah it is. I started working on this and got to a decent point but got distracted.
There are two main things for the Node support:

  • IndexedDB
    • Solved by using a idxdb shim for node which implements sqlite under the hood, and does it transparently (no calling code has to be adjusted) - this seems to work well with this PR
  • gRPC
    • This can't be solved otherwise than on infra side, since we cant do native gRPC (HTTP/2) in node, we want to do HTTP/1.1 gRPC-Web, but that doesnt work because the current infra setup employs a redirect converting such requests to gRPC, but only in web context. So my current idea is to provide a version of the node that always redirects (testnet-web or similar), I enquired already with gateway what effort that would be and it would be low, so I think that will constitute the bulk of my proposal.

So its almost there but needs some polish (hence the draft).
Happy to hear your thoughts on the approach though.

@igamigo
Copy link
Collaborator

igamigo commented Dec 8, 2025

I see, so basically what we briefly discussed in the issue.

  • IndexedDB
    • Solved by using a idxdb shim for node which implements sqlite under the hood, and does it transparently (no calling code has to be adjusted) - this seems to work well with this PR

This is cool if it works well enough, but we already currently logically separate store implementations through the Store trait, so I wonder if we could provide a different implementation that is native (ie, that does not require the IndexedDB shim). In this sense, we should be able to provide a way of instantiating a WebClient with a native SQL store (that would not be available in browser contexts) or the browser-compatible IndexedDB store. I think this might require some changes to the WebAuthenticator and how it relates to the WebClient (see this)

  • gRPC
    • This can't be solved otherwise than on infra side, since we cant do native gRPC (HTTP/2) in node, we want to do HTTP/1.1 gRPC-Web, but that doesnt work because the current infra setup employs a redirect converting such requests to gRPC, but only in web context. So my current idea is to provide a version of the node that always redirects (testnet-web or similar), I enquired already with gateway what effort that would be and it would be low, so I think that will constitute the bulk of my proposal.

What stops using native gRPC in node environments? After a quick search there do seem to be a few libraries that do this, but it's possible I'm missing something. In this case too I think we already mostly have the right abstraction (the NodeRpcClient trait), so I wonder if we could just create an RPC client crate/mod that forwards calls to @grpc/grpc-js and then we ship a node entrypoint that uses this instead of the current tonic-web-wasm-client-based RpcClient (that goes through the browser's fetch()(

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

Successfully merging this pull request may close these issues.

3 participants