How can I update protobuf file for client when server changed - node.js

I'm new in microservices ecosystem and I've just start study about gRPC. But I have a problem when I try to understand gRPC and Protobuf workflow.
First, I have a server and a client talk to each other via gRPC with NodeJS. Then I got a problem with my server so I have to fix it. But unfortunately, I have to change protobuf file too because I realize that error come from my gRPC Service.
So, for now I'm change protobuf file in both client and server manually. But I want to change(sync) proto file in client automatically(that's microservices, right?).
Please show me your method to make it auto! :(

The easiest way to automate this by extracting out your .proto file in a separate project and build a pipeline which will generate stub code and publish it to a common place. And then you can use that by adding it as a dependency to your client and server.
But as #Kenton said, you don't have to update your .proto file at the client for all the changes, it's backward compatible by default.

Related

Can I use STOMP in nodejs without message broker?

I'm working on creating mock sever for my Angular application. On frontend I have library for STOMP. And regularly my frontend communicates with Api written in Java.
But additionally I start mock nodejs api which returns hard coded Json files when remote server is down.
Now I'm trying to write mock nodejs websockets server which will community with Angular client when remote server is down. But I would like to keep it simple
I found StompJs library but seems like it needs STOMP message broker (like Rabbit?). It's seems to me a bit complicated for mock server. Is there any option to skip this broker step and keep it as simple as possible?

Angular Universal with GRPC

Im having issues with setting up GRPC inside Angular Universal App.
Basically, it throws an error:
ERROR Error: This environment's XHR implementation cannot support binary transfer.
This error is breaking the application on production (hosting it on ubuntu and nginx), but, in local envioroment it works.
If I switch Angular to not use SSR, then it works fine.
My assumption is that in the Node Express server I need to add support for GRPC, but im not sure how to achieve that.
Did someone had the same problem?
Thanks!
If no grpc library is defined, adding improbable-eng should solve the issue. The mentioned error message occurs when the transport protocol is not NodeHttpTransport.

Generate ClientHello and ServerHello using node

I would like to generate ClientHello and ServerHello messages using NodeJs for testing purposes.
Is there an easy way to generate these messages using NodeJS API (the HTTPS all ready doing it but I can't find where).
If I can't use an existing API then how do I create the simplest messages according to the RFC using NodeJS (How to build the messages in a Buffer correctly)

Jest mock testing with protobuf

I am curious if there are testing examples using jest, using dynamically generated node clients in build/protobuf
I am implementing a node client which dynamically generate protobuf files of the service it is calling, and calls the service via grpc. I am confused as how do we mock .proto files

language server protocol: sync at editor start-up

I'm implementing both client and server side for LSP.
I'd like to follow the protocol as strictly as possible.
When I start my editor (the client) it should inform the server what the local code base looks like right now, (a git sha plus some changes since most-recent-common-ancestor,) so that the server can answer correctly when I e.g. go-to-definition.
How do you do that in LSP?
I know I can send a textDocument/didChange for each document which has changes since most-recent-common-ancestor.
But how can the server send its current git SHA to the client, and how can the client send the most-recent-common-ancestor to the server? As far as I can see, this information is needed, but not part of the Langserver Protocol.
The LSP is currently designed with the assumption that both the LSP client and server can access the same filesystem - for which such "sync" operations are not necessary. It also doesn't assume anything about SCM or Git (which is fair as most of the code written isn't necessarily in a Git repository).
You can add extensions to the protocol to let the client (IDE or editor) send a "snapshot" of the project on startup, but it would become both server and client specific integration, diminishing the value of using LSP.

Resources