Visitar URL original
Protobuf support · Issue #7632 · NativeScript/NativeScript · GitHub
Skip to content

Protobuf support #7632

Description

@rynop

Describe the solution you'd like

Protobuf based frameworks like gRPC and Twirp (made by Twitch) are very popular because of the efficiencies gained in front->backend handshake clarity, straightforward for teams of devs to understand and manage, and size of payload over the wire (extra appealing to mobile).

Ultimately the solution I'd like is to send protobuf (binary) from the NS HTTP Framework module and be able to receive a protobuf (binary) response.

My hope is the market trend towards protobuf based technologies will give further motivation to supporting sending and receiving these (small) binary payloads.

Describe alternatives you've considered

Writing protobuf to then filesystem then sending via nativescript-background-http in the background. Not only is this super messy, it is very error prone (and hard to recover from). Not good for the mission critical path of your app interfacing with backend.

Questions for starting discussion

I know there are a few outstanding issues (see below) around supporting binary, my hope is this issue can bring them together with a solid use case (Protobuf).

  1. Support to accept gzip (binary) incoming payloads was added here. Can this methodology be used to accept application/protobuf?
  2. protobuf.js is rock solid and works in node and browser. What are the specific technical road blocks preventing it from being used in NS? In searching and looking at code I can't tell what they are (I'm green to native dev).

Additional context

Activity

  1. charsleysa commented on Aug 15, 2019

    @charsleysa
    Contributor

    Hi @rynop

    Our company is currently about to release a production app that uses a modified version of the Nativescript http library that allows binary upload (we did use it from Angular HttpClient).

    From what I can see our modified version should solve all those issues linked. If there is still a high demand on having binary upload support (read: ArrayBuffer support) I'm willing to create a PR.

  2. rynop commented on Aug 15, 2019

    @rynop
    ContributorAuthor

    Hi @charsleysa

    I'd personally love a PR - and I think it would really help the NS community as a whole. I'm happy to help test and contribute fixes/patches as needed.

    Thanks for your time in advance!

  3. charsleysa commented on Aug 21, 2019

    @charsleysa
    Contributor

    Hi @rynop

    I've created the PR #7707 which implements binary upload support.

    I also took a quick look at protobuf.js and the PR should support it (I've only taken a quick look at it's HTTP code so I can't comment about any other requirements it might have).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions