FULL PROJECT - GO + GRPC

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome back this video will be a part of the 45 colang project series playlist so there are about 44 videos in that playlist now so this will be the 45th one uh so depending on when you're seeing this video there will be uh many more like they could be 50 or 60 projects in that playlist so you just have to go to my YouTube channel the playlist Tab and just search for this playlist which is like 40 either 45 or 60 depending on when you're seeing this that like you know so many different uh videos in that playlist actually let me show it to you so you just have to go to Akil Sharma and here in my playlists so out you will find this uh this one right now there are 44 videos so this will be the 45th and then maybe if you're watching this like many months down the line there could be like 60 videos in this so I'll keep continuing this playlist and my goal is to have like a lot of projects so that you don't have to buy any uh course probably and this could be like the one stop solution for learning golang right so we've covered so much in this playlist this postgres there's mongodb there's redis there's serverless stuff there's AI also scrapers you know complete grad projects with authentication there are blockchains uh we did graphql recently we did Echo and today is all going to be about grpc so today's project let me just put my phone on silent so today's project is going to be all about grpc now you will find resources about grpc on the internet but uh you won't find them with this type of type of clarity because you know learning from somebody who's used in production uh learning it from somebody who uses it in his product products or projects uh you know on a daily basis uh so with this level of clarity is something you won't get online that's uh you know definitely I mean if you find on like YouTube udemy or on websites you won't find uh information with this level of clarity um the thing is I wanted to show you like a full-blown big project with grpc but the thing is I've I want to get started with a smaller project first like a very small little project today like a quick grpc demo because the technology this technology can be slightly confusing to many people so this is why I wanted to start with a small project and again uh I I want to thank thank my intern nikhil who now helps me research and think of ideas of what to build uh because if it was if it were left to me I would end up building just really big projects and uh you know viewers would have a lot of difficulty but now I have somebody who can you know guide or at least I can consult somebody okay you know build like small projects because because he's a really young kid right he's a uh he's a college kid so so I can ask him you know should we build like small projects so yeah so we decided on building like a very small grpc project now and then building up on it like we'll build two more projects we'll be like full-on projects in the future all right [Music] my intern all right so now uh uh the the videos that I make now uh they require a lot more hard work right so I have so we have to build uh the entire project uh thinking of what all the exact things that we'll cover and from that angle we built the entire project and then we push it on GitHub beforehand so that you guys don't have any issues when you build it with me in case you have any issues you can always go to the GitHub code and you can always like sort it out like you know it's the code is always with you it's always available and also we're trying to put these readme files where you know how to like start the project in case you wanted to you could you could also have uh you know those those details there so just want to point point out that the project is already there on GitHub I I didn't have this kind of a process or workflow before uh because um you know I I just used to come online and build it with you guys but now like you know uh to to enhance your viewer experience or whatever we've started following this process where I just built it beforehand and then I come online but but because of this I'm obviously not able to put as many videos as before like the frequency has definitely gone down but then this ensures that you guys like don't have any uh doubts after after we're done right because I've we've noticed that many young people also follow my channel it's not just experienced developers right so I'm trying to take uh make content for everybody anyhow a lot of talk there so this is uh the code I'm akhil Sharma 90 on GitHub you can find a lot more uh stuff here for rust for golang so there's also 50 rust Project Playlist going on on my channel there's a lot of rust collank stuff here uh there's also stuff for Solana and ethereum so and it's all or like it's all open open source free feel free to pick up anything put it in your portfolio my main agenda is is you know you should use these projects and get a job if you can and that's like the most uh important goal for me uh because I don't do this for money YouTube is not like this is not my uh you know profession or or I'm not even an instructor actually I'm just a developer and I have my own companies and I just do this for uh just sharing this with the community that's it and also for me to stay Hands-On that's about it that's the whole agenda so use these projects put it in your portfolio get jobs and tag me or let me know if you get a job uh that'll make me really happy right so that's my main agenda with this all right so uh by the way I'm building this company called armors and in case you get time you can check it out also all right so this was about the project now uh coming back to um grpc which is today's topic right let me put this in full screen so what is grpc why do you want to learn it all right so I don't want to start coding directly because it is a different technology it's different to what we've done and uh I there's a reason why I wanted to cover grpc because uh I want to start tackling some bigger topics and for those to be able to tackle those topics let me remove these headphones now to be able to tackle those topics uh we need to know grpc okay so I'll talk about those as well now this is what a regular architecture looks like and this is what we have been doing right even even if we've been working with graphql which we've been doing recently on my channel even if we have done graphqlr even if we've done rest apis or any any soap apis whatever you've done in the past what happens is you send a request to the server from the client and the server sends you back a response right so this is what a client server architecture like request response architecture looks like right the rest apis or graphql or soap apis whatever you use this is what you've been doing all all this while so it's synchronous in the sense you send requests and you wait for the response for that particular request so it's synchronous yeah it's slow because you have to wait for the request to come back and it's not scalable uh it's not scalable in conditions where let's say you're using microservices uh or you're using a lot of different servers a lot of different clients right so which request is going to which client or which server is talking to which other server so many servers are talking to each other all of that stuff um a request response architecture is not very scalable because it leads to too many Network requests right it's difficult to take to keep a track of all these requests as well all right so how do you scale it uh one proposed way of scaling it is having remote procedure calls where the client can directly call functions from from the client to the server so that's why it's called as a remote in the sense from a distance procedure calls in the sense you're calling a function at the server side directly so it almost feels like the client and server are together and the client is actually calling the functions from the server right so it's a very very different approach and instead of Json you use something called s protobuf and the size of payloads is very small and it because the size of payload is very small as a like it's a fraction of the size of a Json object so it accelerates communication between the client and server okay so that's the main thing with rpcs remote processed calls right so the kind of explanation I'm going through here with you guys it took me a while to put this board together all right and you you don't find this kind of explanation even in paid courses that you'll purchase you won't find this kind of explanation because like I said you know learning from from a learning from a guy who's built stuff like will use this in production it's it's completely different I mean that's that's a whole different story right as opposed to learning from uh just some just an instructor who whose job is to instruct or just a YouTuber all right so that's the benefit you get when you work like when you are with me that uh you know whatever I do in the real world I come and show it to you here okay that's my main agenda because uh when I was building stuff as a young kid I didn't have mentors to look up to and people who had built stuff right uh there were many teachers and instructors and YouTubers but uh like not people who built stuff right uh and you get a different perspective from people who've built stuff anyhow so I want to be that Mentor like you're online Mentor obviously it's all async here because uh you know um because I teach at scale on YouTube or whatever whatever but at least you have access to this kind of information anyhow so how does that work between plan and server uh you have something called as streaming streaming is is that there's a continuous flow of data in the sense there was a request and response earlier but now you have a stream stream of data between the client and server it's a continuous flow of data between them all right it's asynchronous in the sense client is not waiting for a message back from the server for for a response back from the server okay it can keep between its own thing things and keep sending messages to the server and keeps getting back something from the server but it's all in asynchronous it's extremely scalable because it's not a lot of network requests it doesn't lead to a lot of network requests which are you know everybody's waiting for everybody to get back some data nothing like that is happening here and what's the use case why do I want to teach you this is because the reason I want to teach you this is because uh maybe you know that from the beginning of this channel I've wanted to teach you guys microservices but we have not been able to reach here because every time I I want to teach you this stuff uh I get so many queries about the basics like in the sense uh developers are not able to work with mongodb or postgres or uh you know all these databases with with golang and uh and even with grpc so I want to I want to tackle these Technologies because you use all of these when you build a microservices architecture right because you'll have different services and then you'll have uh different microservices and then you'll have like different database for each microservice something like that you know you want to know Docker little bit of Docker you want to know a little bit of you know different databases how to connect them to to golang you also want to know how to build cruds you also want to know how to work with graphql because uh when the users they call the apis they can they can use graphql but between the client and server and the servers themselves we can have grpc communication so this is why I want to teach you grpc the use cases are micro services and the use cases are also blockchains now I I want to cover more depth in blockchain so we've done like two three blockchain projects before uh in this series itself this playlist itself but I want to do more so uh blockchains when the peers they interact with each other they don't make um requests like regular requests and response they don't function that because a function like that because there's so many peers so many nodes on in a blockchain network and they all have to communicate with each other they have to gossip with each other to come to a consensus right so all of that doesn't happen with the request response architecture that only happens with streaming data streaming and which needs a continuous flow of data between uh the peers and the nodes or the client and the servers whatever okay now if you've connected a client and a server together in grpc you can either you can do like four types of communication between the client and server okay you can have like regular request and response also so it's not like once you you know integrate the grpc or you've you've include grps in your project you can't do regular requested response you can do that and that's called as a Unity API so you can just call the client from the client to the server and just get response back that's it it's called as a Unity API so there's there is provision to do that it's not like you sacrifice that right when you move the grpc the second thing that you do is call a server streaming okay so what happens is the client makes a request like a regular request to the server but the server uh sends a string back okay it's like a there's like a sequence of messages so you send a request and you get a sequence of message or like a complete stream back to the client that's called a server streaming then you have client streaming where the client sends a stream of messages to the server and the server just sends a response back that's it right so I'll just repeat again the client in server side streaming just sends a request that hey I want this data instead of selling just one big response object you get a stream of data back right uh similarly with client uh with client streaming the client uh instead of just sending one simple request to the server it sends a stream of requests to the server like a stream of data to the server server can obviously you know segregate or or you know like divide it or what you call it disintegrated and then you know work with that so and then you can just send send one response but the most common use case which you'll see very often is the bi-directional streaming okay this is where the client and server both communicate using streams so uh the client sends a stream of messages to the server server disintegrates that information and then sends a stream of information back to the client and this is not happening uh synchronously it's not like the client has to First send the stream of messages and then only the client consider it's not like that they can both do that in parallel so there's information from the clientele server information flowing from the server to the client uh at the same time like asynchronously okay that's the beauty that's the beauty of grpc this is why everybody uses it this is this is why uh you know it's worth like shifting to grpc and um even though it's a stream right so we mentioned the stream of information between the client servers even as a stream another queue uh even though it's a stream the order of the messages is preserved okay I mean you know which message came first which made message came second third fourth uh and even though there's like not synchronous information and it's all async but there's there is a an awareness of the context and of the order of the messages that are being sent between the client and the server right so this is a great great introduction I mean um it's quite possible that you didn't get all of this in one go uh feel free to repeat the video feel free to go over it again okay and uh like watch it like a couple of times but you will definitely get it this is the most uh this this is the clearest and the simplest introduction to grpc that you will find on the internet for sure okay because I've seen so many introductions and I've like I've used it like I said in production and I know how it works like the underlying technology now like really really well so the way I'm explaining it to you uh just watch it a couple of times in case you didn't get it I'm pretty sure you got it like I'm pretty sure you understood what I'm trying to say but in case you didn't get it um just just go through it right so basically what you want to do is you wanna uh work with scalability because when you have microservices or blockchains there's so much Communications taking place uh you don't want to have request response architecture because it's very synchronous you have to wait the size of the data packets is very big because Json you want to switch to grpc that's the whole agenda that's the whole uh that's the whole point here okay so this was the definition now I'll show you a quick tip yeah so I wanted to show you a demo but what happened was instead of pressing f11 I pressed F7 by mistake like f11 I wanted to uh you know exit the full screen and then like minimize it but by mistake I press F7 so whatever I was speaking I think you couldn't hear after that so I'm just starting another uh like a recording stream here uh all right so basically what I want to do is I want to start a server on a separate terminal uh which will be on the left and I want to start a client on the separate term which is on the on the right so I'll show you four different examples when in our code we'll have four different examples but right now I'm just showing you an example of bi-directional streaming on the sense how bi-directional streaming takes place so here we'll say go run star dot goal in the sense starting all the go files in the server folder and the client also I'll do the same go run star dot go so here it says bi-directional streaming started so it's in sending a message hello Akil here it's saying got request of the name akhil Alice Bob and then by additional streaming finished from uh client server side another server is still on but the client has stopped the partitions streaming so this is by additional steaming from our side so I'm just showing you just one example but there will be four examples that we actually go through today one will be obviously the unity API for the request response then we'll have like server side streaming plan style streaming and the buy Direction streaming right so uh we'll go through all the four examples uh what we'll do now is I'll just Park these uh should I just I think I'll just close this down and what I'll do is I'll start a new project off with you guys so I'll just uh go out of this I'll say mkdir grpc demo and YT for YouTube obviously for you guys and I will CD into it so I'll says white okay and we'll clear this out now and now is when we'll uh start [Music] so first things first you'll say go mod init plus a kill slash grpc demo writing okay check if the go mod was created open this up and vs code so there's only a go mod file here right uh but we're gonna do a lot more so we'll have a separate folder for our client a separate folder for our server and a separate folder for something called as Proto the Proto buff that I was talking about before okay in the client you'll have its own main.go file so just remember the client makes requests to the server server has its own main.co file okay and then the Proto Proto is going to have its own uh Great Dot profile now the Greet up dot profile is the file that you write everything in so you define the remote procedure calls that will happen between the client and the server so you'll Define all the remote procedure calls here in the grid dot profile but the actual code that's required for the interactions to happen between client and server that actual code will be in something called as the pb.go files and that files those files will be generated for you right so there will be a PB dot go file like a greet dot PB dot go file because we have Green Dot Proto and there will be the grid underscore grpc.pb.co file right so there will be two files they will be generated automatically for us so it's very similar to graphql like how in graphql just create this schema everything else is created for you here you do have to do a little more work because you have to create the actual client and server functions and you actually have to write the report like Define the RPC calls here but the the actual pb.go files like for the grpcn for the regular PBR files those are created for you right with the code gen so uh what you want to do here is the the first thing the best thing to do is uh to to start off your grid dot profile okay uh so the way you do it is you say syntax and we're we're working with proto3 [Music] okay now you'll see that my profile is in a different color it's because I'm using an extension for Proto uh let me show you which one I'm using this one like I think one of these like vs code protocol yeah sorry this one vs code 403 support So this just colors your code so that you can just it just becomes a little more readable otherwise everything will be in white because vs code on its own doesn't recognize Proto uh the important thing here is this option go package right [Music] uh you want to get this right because the files that will get created will get created in this uh link right in this place so the the two ways that you'll usually see on the internet to do this one is that they will write the name of the package here like this whole thing here uh out here and then when they'll run it you'll have to change the CLI command a little bit and then the files will be generated in your Proto Proto uh folder but the easiest way to do it uh if especially if you're a beginner is just leave it like this just have like dot slash Proto because this is where those files will get generated okay so you don't want to mess around with it too much what is this package called just like on all golang files you have a package right so here it's going to be called great service package and then in your service you'll have something called as the Greet service now this function uh by the way all the things that you're seeing here are going to be very common in the sense you will be using this kind of a format very often in the future in all of your future projects so it's not like something that you're doing for the first time or you're doing it only once and everything else is going to look very different but GI Proto is very very opinionated in the sense the way you write the code right now today in this project is going to look very similar to any project that you find on the internet on GitHub or uh do you end up building or you find on YouTube or udemy it's going to be very look very very similar to this okay so you usually have like a service uh here which is which could be called anything else we're calling it grid service and this is what it is going to have my rpcs right so let's say the first RPC is say hello this is now this is my unary RPC I showed I told you there will be four types of RPC calls unary API which is just a request response uh server streaming client streaming and bidirectional bi-directional streaming right so first we're working with this one so here it takes in more parameters it's just a request and response it returns a hello response let's say okay now hello response is something that we have not defined yet uh so let's define these messages so no program is also a message that we need to Define and we also need to define a message called hello response okay what does it look like it just looks like this it has a message [Music] all right this is my uh say hello right then I will have an RPC for server side like I said there are four types right the first is secondary server type streaming and I'm going to stream hey I'm going to pass a names list two so if you remember what server side streaming is the client sends a request to the server server sends back a stream so the request that I want to send is called names list that's the request that's the object that I'll send in the request uh but what I'll get back is a hello response but it's actually a stream so whenever I write stream here right has to be with a small s make sure of that so whenever I write stream here it's it says it's going to like send me back a stream right so I hope everything is very clear I'm taking a lot of time to explain everything taking a lot of time to go really slow explaining every single line to you right because grpc is something that's going to be very fundamental very important for all the microservices and blockchains like the bigger blockchain products that we'll do in the future it's going to be very very fundamental so RPC say hello then you have something called as client streaming like I said the third one it's going to take in a stream right so from the client a stream goes to the server but the server just responds with a simple response which is called as a message list now uh please understand it doesn't say stream here but it says stream here so whenever it stays stream that's the type of streaming it is so it's getting a stream back from the server so it's a server side streaming it's getting a sending a stream from the client to to the server so it's a client-side streaming and from Server doesn't get back like a stream it just gets back a list of the messages okay okay then you'll have say hello Buy directional streaming right from both sides streaming from both sides so it accepts a stream and also returns hey stream okay hello requesting her response like I said the fourth is the one that you'll see being used very very commonly everywhere now we have not defined we've defined hello response but we have not defined hello request messages list right we've not defined that so let's do that so and also we've not defined the names list okay so you gotta Define all of that so we'll say message hello requests out here we'll say message hello request out here and we'll say string name is equal to one okay we'll send a name get a message back so send a name in the request get a message back in the response now what's the name list the name list is actually heated string names equal to one okay and what's the message list message list messages list it's actually again repeated string messages to do one and that is it you see these 32 lines of code this is it you don't have to do anything else with Proto all right nothing else so the spelling I'm going to fix the spelling here no param the file you don't see any errors here um and you don't see anything any complexity here and by the way guys this is it this is your profile you don't have to do anything else here no no extra work required no more work required this is it all right uh for the time being I'll just write package main here okay so that I just the errors go away write package main here okay so just once more I'll just repeat it once more three three lines of code even which even have like these spaces uh but this is it this is all that's required to start off these four different types of RPC calls between the client and server don't have to do anything else this is it all right now all you have to do is use the profile and generate some code like I said the pb.go file and the pbgrpc.go file that's what we want to generate now okay so what do you do what you do you say Proto C right so this also means when I when I'm writing procy here this also means that you need to have Proto C which is the Proto compiler uh in your system right so a great way to do it is using app install uh for Ubuntu for Mac you have Homebrew for Windows you have choco which is a package manager or just the direct like regular Windows install also will work uh in case you want like the best and the freshest version of grpc which uh like if you have 3.12 3.15 I think things will work perfectly fine but if you need like three 3.19 or 3.20 21 I think 3.21.12 is the latest one right now so usually people building projects right now in 2022 they'll you'll see them use 3.19 and above so if you in case you want to use any of those like the recent ones then you have to um actually let me show you if I if I have it here so grpc install [Music] um [Music] yeah so you you need these two if if like again I think it's optional you don't you don't have to have them but just like just run these two commands anyways in the projects folder that you're in just run these two commands go install uh and like I did you know I just went to grpc.io talk slash languages or on Google I just said go grpc golang installed and you'll come to this link uh these are again like I said optional but just have them if if you want like uh just run these two commands and you might want to do this also sometimes uh the the producing command that I'm about to show you might not work sometimes so you want to you want to do that you want to do this also sometimes right so in case you get any errors make sure you run this also in your terminal okay uh and and if your go path is not uh you know set properly for example in my case I'm using WSL too so it keeps getting reset so if in my case every time I'm on my terminal every time I open up a new terminal I I do run this command actually to to make sure things work but you don't have to it it's like completely optional uh you can do it if you want like skip it if you want but if you're getting getting an error like I said you want you might want to do this and you might want to run these two commands also again optional but the one thing that you definitely need is uh where is the company yeah Pro buffer compiler installation this is the one you need okay so like I said the one way to do it is app install Mac OS you do uh you know Homebrew uh but if you want like a particular version like the latest version and this is also how I have done it is that you create this variable uh called pbrl and you uh you know fill that up with the protocol buffers Pro buff releases link and then you make a call to that link pbrl after that you have download and the version you can mention a specific version like 3.19 or let me Zoom this in in case you're watching this on iPad or phone or whatever sometimes yeah people watch it on like very small screens like a 12 inch 13 inch 14 inch screen while I create these videos on a huge screen so that that's a discrepancy sometimes so I do have now a Big Font in all of my vs code and my terminal everything but sometimes when I'm browsing the internet maybe you'll find that it's it's uh you know it's really small but do I like apologize for that in case you have those issues here but yeah so what you want to do is here you replace this with like 3.19.4 or any any other specific version that you want and then you just unzip it sometimes you don't have unzip on your system so you want to install the unzip package with the app installed right so many people have that issue so you get that and then you export your environment variable like I showed you and then everything should work perfectly fine uh what you want to do is you want to run Proto C minus minus version I'll just uh zoom in again for C minus minus version this is the one that should work perfectly fine all right this command should work perfectly fine and then you're good to go good to go uh let me show you how that looks so if I say Proto C minus minus version it says 3.914 so I'm using 3.914 you could be using uh like higher than this or like even 3.12 L 3.15 should be stable I don't think it should uh they will lead to any problems but just make sure if you if you can if you can make sure just have this and make sure this is this command is definitely working right so once we have that we can start building our project now that we have left to see uh what I want to do is I want you to say Proto C minus minus Co underscore out is equal to Dot so it's not got sorry go underscore out okay and then you'll say minus minus Co PC out is equal to Dot all right so what's happening here is um I told you there will be two files that will be created one will be the go dot PB the other will be the go grpc.pp file okay so uh we want these two files to be created uh in this location which is the current location and we'll say the Proto file as in the Proto folder slash create dot photo so Green Dot Pro is the name of our file it's in the Proto folder and depending on um [Music] depending on this as at the Go package this is where the files will be created right so we will hit enter and now it doesn't give out any output right so that's what you want that's the ideal State actually and let me minimize this so here you'll see the two files have been created pb.go and grpcpv.com okay again let me show you this command go out create the current directory grpc out created the current directory and Proto slash create dot Proto is where you um you have the Green Dot protocol file and because of that because it will go and read the grid dot Proto file I'll say that the place where it's supposed to create these two files is this so we'll create the output there exactly okay now uh what you'll do is uh we'll say go more tidy because we can see in our PB dot go npb grpc go file that some of the packages are missing and that's why it's giving us these red line errors and now they've all gone away so that's uh that's a great place to be okay so you have your main client you have your main server but we have not written any code there yet which is not ideal we should bring some code there so what we'll say is uh in our server we'll create a server okay so firstly I'll Define a port on which the server will run so I'll say it's port 8080. okay then I'll have my func main here my main function in my funk pane I will create a listener so I'll say less is equal to net Dot listen TCP Port from Port so I'll save and I'll get the net package here getting to lines here because I have not handled here and I want also not to decide what to look at this at the moment so first let's handle the error so if error not equal to nil I'll say log dot f ailed to start the server come on error print out the error I don't have the log package also as well just say Ctrl s will get the log package for me okay so I have the port but I want to create the grpc so so to create a grpc server we'll say grpc dot new server okay I don't have the grpc package so let me get that so it's Google remote protocol calling okay so that's remote procedure calling sorry it's for Google so it's grpc.new server and now um I'll say if error equal to grpc server [Music] dot serve and we'll pass the port there Lis so let's pass the poster there lis and headers handle the error foreign [Music] start percentage V comma matters okay now that's not all right that's not all we also need to let's say PB right PV wins this uh the Proto stuff here Dot register greet service server right so if you remember we created a great service and we have all these functions there but to create uh the server with context to the grid service so we'll say pb.registercrete server and here we'll pass a grpc server comma and percent hello server okay so let's worry about hello server in a while for now just say log printf and servers started at percentage V and you listen on this address so bye bye oh like I'm always writing it as list not list basically now hello server right so hello server is something you'll come and create out here so it's a type hello server sorry my door is uh feeling a lot of noise I'll fix it in a while it's very windy today so that's why my door is [Music] no all right anyhow so here you're supposed to say PV Dot create service service server now you don't have PB so PB is essentially your protobuf so what you'll say is Define this as PB and we'll say it's github.com slash a kill slash basically you want to get it from here right from your go dot mod slash crpc demo YT so let's say I'll say YT slash photo so that's PB and now you have everything sorted here your may not go file for Server now this is all the code you need to start off your server on port 8080 so I'll take you through it again firstly you need PB PB is basically your Proto all all your you know files related to photoshop including the files that were just created right so if we can see all of this files so much so much data was created for you so much code has been created for you guys right um as you can see there's also grpc and everything basically relates to the prototypicator so you see here say hello say hello server streaming client streaming by distance streaming these are all created from our uh service create service right so this is why we also want to talk about our grid service so we start like a you know server which is capable of uh you know running the Greet service basically so that's why our server says registry server and we pass our grp server there which is uh you know created with the help of the grpc package it's a new server function and you're listening on port 8080 and you say say send here your hello server which is basically create service so right it helps you to register that service then you start your server and then you serve on that address and then if there's a problem it'll say fail to start so that's it that's your uh server code now the client as we know client is supposed to make requests to the server okay uh but we won't be making secure requests we're making like uh not secure requests so first let's start with the same thing so I told you that it's almost like the client is making a functional request on the server side so that means they both need to be interacting on the same port I'll Define the port here again as 8080 [Music] okay so that's our constant go to 8080 [Music] and I'll have another function here called func Main which will be my client so I have to start off a client here so it's a connection error grpc DOT type now how do you make a HTTP request we use some functions in the HTTP package and then make a request to the server right to a website to a server that's how you make client requests or server server requests from a client in golang the concept is very similar with grpc as well so you have a golang program which is going to run off as a client and the client is going to make request to a server so that's why you use the grpc.dial function here so here you'll say localhost class port from RG or PC dot with transport credentials and here I'll say insecure like I said you know we're not using uh any secure credentials so we'll say taught new credentials [Music] okay and this is it so I'll just keep this open for a while so that you can see it in case you didn't see it this local also for Plus Port so localhost Port basically is 8080 here and not using any secure credentials and secure credentials obviously I'm getting deadlines here because I want to handle the error and do something about the connection variable that I just created so I'll handle the error first I'll say log dot fatal f that's not connect [Music] and I want to have this uh connection closing and I'm going to defer it so we want to do a lot of stuff from the client to the server but at the end when everything is over we want to close the connection between the clientele server right that's what that's how you see that right when you when I showed you the demo about the client and the server the server kept running with the client closed down after making the requests so that's what's happening so at the end when everything is done you want to close the connection from the time to the server so that's why I've set default default basically ensures that this function runs at the very end of the execution PB dot new greet service client and you send connection here [Music] you have names equal to Ampersand PB Dot names list and names so I want to send some names here say let's say a kill and I'll use standard blockchain names Alice and Bob so whenever you configure a blockchain or or work with a new blockchain you have to configure these addresses like Alice Bob and all that so I'm just keeping those as a standard addresses here and now the first function that I have is called say hello and client okay so the client pick this save it hopefully I get all of these uh and I'll I'll uh comment this out for now and we'll have to obviously create this function in one of the different files but now I need PB here again so firstly what I'll do is I'll say PB and then github.com slash okay slash grpc demo righty slash okay and now it can't find this function that's understandable because we've not created that function yet and now it's not uh you know we don't have any use for the client so that's why let's create a problem so let's keep this out commented out for now okay everything will make a lot more sense in a while so uh we have a basic server code ready and we have a basic client ready but it doesn't do anything like it'll just start off the server and the client but there's no point of having this there's no point as of now what do I actually you want to do is you want to start having our firstly our unary API then our client server our server stream sorry client streaming server streaming and bias directional streaming so if you want to we want to demonstrate all of those things so what I'll do is I'll create a new file here called uh as unary for my Unity API okay and here I'll say that this also belongs to package Main so function hello server now this is a method that means the method for hello server struct and the function is called say hello right so I'm demonstrating the very first function it takes in context Dot context comma request takes in a request [Music] no param and it returns a response so I told you that unary API is the very like the very basic straightforward API where you just send a request you get a response back so here you'll say PV dot hello response comma and from here you want to say return Ampersand PB dot hello response and you want to say a message [Music] hello comma nail again you need you need PB here so it did get context for me but I also need [Music] PB here not sure why he's not able to get PB for me I need it again I'll say PB github.com actually I'll just copy the same thing from here but I have it I have it here here let's copy and paste this [Music] okay sorry these are supposed to be round brackets okay so this is your unary server function which is called as say hello now from my client I want to call that function like I said you know call say hello and that function also needs to be there in my client side so I'll say unary dot go okay I'll create a new file for it now I could have done everything in one single file but I want to demonstrate everything to you so that's why I'm not doing it so here is my function called call say hello right the one that I'm calling from my main function calls hello is actually here in the unity.co file so here I'll say client PV Dot grid service client here I'll say context cancel context dot with timeout context.background comma the time packet so we definitely need the time package here so firstly you obviously need PB again so I will copy PB from here and paste it [Music] here now let's do something about the conduction cancel so firstly I'll set it for cancel but cancel the second care off and then I'll say client dot say hello past context PB dot no params and I'll get back my response here or I'll get back an error and I should be able to handle both so if there's an error I'll say if error is not equal to this log dot field f could not breach [Music] comma error okay and log dot print f percentages [Music] what you actually want to do is you basically want to print the response that you get back so like I said client uh this is we're demonstrating a unary API call so like I said there are four ways with four types of RPC calls we've defined in our Proto right there's this regular unitary call which takes in no params and returns a response then we'll be working with server streaming client streaming vibration streaming but right now we're just worried about this one which takes in a param and uh with no param and then returns a response right you all thought we've defined what no param looks like this is nothing basically hello response looks like this now what that means is in our client from our client we'll have to create uh the ability to be able to call our server server you know is looks like this server is basically server JPC server running on port 8080 the client uses the grpc.dial function to call the server okay now um the exact specifications of the unary API are mentioned in the unity.go file in server side and unity.go file in the client side the unity.go file and server side has this function called say hello which is supposed when you call this function it's supposed to return a message called hello right so this is the response right remember it's the response not the stream it's just the response just like a regular API would work and here when you're calling that function plan.clo you're sending a request which is no param request and you're also passing the context but you expect some response back once you get the response back you just want to print out the response and the client side and the client uh terminal when we'll run it you'll see it there now this all sounds really good uh should we should we try to should we try to run something here we can we can we can try to run the server and the client just to be safe just to see that if everything fine uh now there could be errors there could be issues because the code is not complete yet and that's okay if there are issues we'll just move forward we won't try to fix the issues because there's so much code to be done and then obviously we know that in the end everything will work together but right now everything is incomplete we'll still try to save server and client works if it doesn't work even if it doesn't work we'll just go ahead right so CD server and here you have CD and I'll just find my project to your PC demo YT [Music] CD client okay so here I'll say go run star.go and here I'll say go run start but right now uh like as you know nothing is happening here so what we can do is if you want something to happen we can actually call this function let's create a client and let's call say hello function which is the unary our unary uh [Music] ordinary API right so let's just removed this by mistake because I had commented this out so I just removed the PB for me so I have to bring it back again and I will stop this just to be safe started here [Music] right so I got hello uh back so like I said you know we pass something from the clients this is the client terminal this is This Server terminal so we pass something from the client to the server which is that no param request so make a request we get a response back the response being hello so if you look at the code the response that we get back is simply hello when you get the response back and the client we print that response so this is exactly what we expected we expected hello to be printed in the client terminal so everything works exactly the way we want it to work and till now we have demonstrated how to start a client server how to decider sorry how to start a client server and how to make unitary API calls after everything like obviously integrating everything with grpc okay so that's that's a great milestone and now we can uh you know focus on the rest of the stuff now that we've done unary stuff uh we can now do we can now uh take care of the um server streaming so let's come here okay and uh uncomment this out okay uncomment this and comment this out because this was our unary uh you know API and let's create called say hello server stream so we want to see Server string right now so she basically will will have the ability for the client client to just make a request to the server but the server will stream something back to the client that's what we want to build right now okay so that means I first need a function in my server side so what I'll do is I will come here and I will create a file called server underscore stream.com and this again belongs to package Main and obviously I'll need to import some stuff second but most importantly you need a method so I'll say hello server say hello so we're streaming so this is my function takes in a request PV dot names list and [Music] so it's a stream PV Dot [Music] service and of course say hello server [Music] training server and we can't send back an error okay so here we'll say log dot def got request with names right so we we want to send a list of names as a request so we'll print that out at the server in the server terminal so we'll say that hey from the client this is the request we received and it's basically a name a list name right here as you can see it's a list name which is this I killed Alice Bob and that's the thing that we want to put out at the repair server and for the for the names we'll range over the request names so the collection of names that we receive from the request will range over them [Music] and we'll say PB Dot hello response and we'll say message we'll return a message hello plus name for each of the names now let's handle yeah so they will say stream so we'll use a stream function and we'll send the response as a stream okay and we'll handle the error so we'll say if error is not foreign list we go over the name list name list being what we are sending from here this is the name list we'll send us that as request like I said you know as nameless and we'll go over the names uh in that request that we're receiving and we'll create nice little response which is of type hello response hello response is something we have defined here header response um so we'll create a hello response with message which will have hello plus the name of the people from the list one by one and we want to send all of this response as a stream as it's getting created as a stream to the client so that's why we use the stream dot send method [Music] and we want to have some delay so we'll say two seconds delay [Music] okay we want to stipulate with the help of this delay of how an actual big function will look like and how actual streaming will happen otherwise if we don't put this delay then everything will just happen suddenly and everything will close if you want to simulate how it looks like uh in the real world when we'll actually have like really big amount of data streaming between the client and the server to your PC demo ID slash [Music] okay so this is your server streaming function on the server side oh so now we also need this function that will call that function so we need a function that is calls call say hello server stream so say hello server stream is what we just created here say hello server stream right uh so it's it won't be called we just say hello server streaming right and this will be call say hello server stream ing [Music] say hello sort of stream yeah so this function doesn't exist right now so what we'll do is now we will create that function so let's say it is server underscore stream dot go so now we want to create the ability to be able to call the server from our client send a request with the names get back the response as a stream and print it out very straightforward right very very straightforward uh at least that's how it seems from my explanation let's see what else we need to do here so we'll have package main we'll have to import some things and we'll create a function call say hello server string which is this function which we have defined here this one this function okay all right takes in client PV dot read [Music] service client common names which is star PB dot names list okay so log dot printf first if you want to indicate that the streaming has started awesome then you want to say the client dot say hello server streaming right context Dot be all small context Dot background names and you want to say string [Music] comma header [Music] errors and n log dot fatal f but not send names [Music] okay [Music] so you were able to uh you you basically want to call this the server function from here from using your client calling the say hello server streaming function and you know that you send a request but you get back a stream from the server you know that so now we want to be able to process that stream at the client side and print it out right so how do you do that so you'll say for message comma error go to stream dot receive so whatever stream that we have received and the client client makes a request to the server server sends back a stream uh the client now needs to process that stream so it's going to you know go through that stream uh of messages that's received and then wants to print it out and then you'll check if there's an end of file then you want to break [Music] right this could this address could be there if error whatever other error is there if error is not equal to nailed you want to essentially log.fill f error while streaming percentage V errors then here you want to log print Ln message and log dot printf streaming fast [Music] okay right so here you get stream you've received the Stream right you check for end of file check for other errors and you print out the message that received in the Stream right stream dot receive which is the message print it out you go through that print out the entire stream that you've received and then you say streaming finish just like your printed streaming started Source start streaming and then stop streaming so that's your server stream and in your main dot go for client that's the that's the function right now right so the unity one I have commented about the unity function but server stream is open right now and we want to test out our server streaming so what you can do is we can open up open up our terminals again and I will see you again code onstar.co here in this over side go run [Music] right so streaming started like we uh said that we'll print out streaming started and then here it's saying you got the request with names so first we send a request with akhil Alice and Bob we send all of these requests right right and here we want to First print the message okay hello akhil and then we want to press hello Bob and then we want to say streaming finished okay so got a server got a request with the names from the server from the client client got back a stream started the streaming and streaming finished and then it printed out every single message right so now you've seen it in demo what it looks like I'll go through the code once again so what side you got the request with the names that's what you put out the entire list of the names that we received from the client and then we create a nice little response for it we sent that response as a stream uh we had a delay for two seconds and from our client side we called that function we started the streaming finished the streaming and in between we printed out all of the stream that we received from the server so that's your server streaming now client streaming right so from the the next thing that we'll be doing is client streaming where the client streams some data to the server server sends back a request that is it server just sends back a request the client's job is to stream right all right guys so now we have to work with client streaming so I'll go to my server and I will create client stream dot go okay at the server side so the client will stream something to the server and the server just has to send a response so that's what we want to build right now okay uh this is again this belongs to package main sorry will also be importing some things here as We Know as you already know um then comes the function and function will be serve in the same way it will be a method actually it's going to call say hello server instead of server you'll just say client string it accepts a stream [Music] so instead of server you say client everywhere so it's the client streaming server so firstly let's Define a variable called messages of and it'll be a collection of string okay slice basically so we know that the server is going to receive a stream because the client is this is this is for client streaming right so the client is going to stream and 0 to send a stream to the server the server has to accept that stream and process it how do you process it you say stream Dot receive just like we did earlier but at this at the client side and we know that this is coming in the request the stream is coming the request so we'll use a request variable so that things are more consistent and then we'll do the regular stuff you know whenever we work with streams which is checking for end of file [Music] close [Music] PV Dot messages lists and messages [Music] okay so we don't have IO and PB at the moment uh it was able to get us i o but it didn't get us PV so [Music] get that as well and put these two in a bracket which it moved so now it's formatted all right if any error apart from and a file you can check for or we can just say error is not equal to nail and we'll just return the error [Music] then you say log dot printf and just want to print out the request it's a court request with names the name okay we'll print it out one by one because we are in a for Loop so we'll print it out one by one and we'll say comma request.name and our messages uh variable which is actually a collection will keep appending the message to it we'll say messages and hello [Music] comma request start so whatever it was there in the messages it appended hello with and the request name so request is basically this and there will be multiple names in that so that you can access that with help of request.name request will basically be the stream that we just received save it I'll get the log package here and this is it everything is done so this is our client stream but for the uh but for the record the server side now we'll do the same thing at the client side as well so we'll say client underscore streaming.com [Music] again it'll be package Main and then you'll import something obviously okay uh for reporting I know that I know I need the PB thing so I'll get it here because every time creates a lot of problems so here the function is going to be called call say hello but client [Music] grade service client comma names and then PB dot names list okay so firstly you want to say uh client streaming started right so when you start the streaming from the client side to the server side you want to send the list of names as a stream so first you'll say streaming has started then you say client Dot say hello client streaming context background [Music] screen error [Music] then you'll handle this error out here right here it's not equal to nil foreign [Music] now you want to go through all the names the list of all the names and create the request okay so how you'll do that you'll say range over the names dot names okay and here you'll say for an underscore comma name so you'll get access to all of the names one by one in the variable call name and heal your format your request you'll say PB dot hello request we already know that this is a struct hello request and it basically that struct has a name as a field so if you'll say if error is equal to stream dot send request so you've created your request one by one with the name and then you want to send it as a stream so to send it a stream you use the stream dot send function and you send and the request there's [Music] handle the error here itself [Music] say error sending percentage V comma error okay and here you'll say send the request with name percentages [Music] common name [Music] dot sleep second so I need the time package also I'll get the time package log context all of those things okay [Music] finally you'll say stream Dot close and save you'll get a response from the server to read the response you need to uh the stream that you're sending to the backup to the server you need to close that stream and you need to receive the response okay so it's a log dot printf [Music] client streaming finished where it is not equal to nil love that fatal f error while receiving that means you didn't receive the response at the end [Music] problem printf percentage V response dot messages so whatever response did you get you got from the server you want to print out all those messages here okay so that is what you will do [Music] okay so the code seems to be okay for me for now [Music] first things first you need the function here so we'll say call say hello client stream and pass the client and names here and since I know that that I'll also have a bi-directional uh streaming function here so I'll just add it here right now by DirectX now stream pass the client and names there and I'll keep this commented out for now uh I'll keep this also because you want to test this this function call say hello client stream is this one right so we have to mention it here in our main.go because that's the function you want to call and the function already exists here [Music] okay now what we'll do is we'll go back to our terminal and we like I said you know I export my path usually so I'll just copy and paste this command here just a second and I'm going to [Music] Proto uh this is the same proto-c command to create the out and grpc files so whenever we add some new functions we need to just create those uh just need to add those like ensure that this is like updated both these files are updated or not and even after doing those two steps which is adding uh the function here it may not go and also running that protoc command to generate the latest PB dot Co and grpcp.gov files even after that if you're getting these Red Suede lines that means something is wrong right [Music] so we need to figure it out what's wrong now one possible thing is that the name of this function that I'm calling from PB function sorry the struct or interface that I'm calling from PB is is not correct so if I go here and if I search for say client hello streaming server it says that it should be the H should be small right here so here if I go and make that smaller so that takes care of the problem and here say hello client streaming right this one I'll just go and search that also here [Music] also uh it seems like the edge should be small and that also takes care of the issue for me now because this code is generated automatically you need to make like you need to just check this like once once a while or something just to make sure that you're calling the right functions in those Auto generated files uh now the time has come for us to try out the code so I have my server here and I'll clear everything out and I'll create one more terminal and I will CD Dev stuff I keep forgetting where I've kept these projects sometimes now in my client so I'll first start my server right so just to make sure which function is selected right now the function that's selected is the hello client stream that's the one that I want to test right the client stream is what I want to test let's see if everything works perfectly fine so here I'll say go run star.com here I'll say go run star dot code right so I get some errors uh here in the server side is on the server side but in the client side uh clients are streaming started sent the request to the name akhil error while sending eof okay so seems like something went wrong now we'll have to figure out what went wrong and we'll have to fix it so now that you're getting an error I know what the issue is actually so what happened here in the Proto file was that I everything else was say hello like with a capital h here uh by mistake I put a small H and because of that all all the files went out of whack and even though we're calling like we changed this to call this function but they have interdependencies between them and that's why there are these issues all right so it's best to change the protofile and put the capital H there so everybody's consistent and now we will recreate the file so when we recreate it let me minimize all of this when we recreate this what happens is this goes out of whack which is perfect because which is good we expect and and everything makes sense it's all it's all making sense now because there's interdependencies between those functions and everything uh now when we try running this program hopefully everything should work out perfectly so I will enter into server okay and here I am already into client so here I'll say go run star.co and here it will again say to run start code so client-side streaming started sending requests with akhil Alice there's a two second delay right so Bob has already come here but here I think we'll have to just refresh right and then Clan streaming finished and then you've got the entire um response back hello Akil hello Alice Hello pop got the entire response back and also you've uh started and finished the streaming sent it to the server and server sent us back the uh response right so client also works out perfectly fine for us and I'll just stop this server also just remember to swap the server with Ctrl c not with Ctrl Z because what happens is sometimes it doesn't free up your Port when you press Ctrl C Ctrl Z Ctrl C is more of a is a better option anyhow uh so I've been shooting for quite some time ah all right so the next thing that we have to do is um is the bi-directional streaming Okay so so we can start from the server side so we'll say pi foreign I'll close off everything else and just make sure you have the vibrational stream function uncommented so here we'll say package main now this is the last thing so bio detection stream is the last thing we want to demonstrate so I'm happy because now I'll get to take a break after this shooting is is like shooting these videos is a lot of work uh so it's greater I'll get to take a break after this so it's a function again it's a method sorry so s hello server and then you want to say say hello uh bi-directional [Music] streaming uh so as you know it takes in stream PB Dot create service [Music] and and I've already shown you in case you're confused about these interfaces you can always go to the grpc dot pb.go file and then just pick it up from there hello bi-directional streaming server let me get an error back it doesn't know what PB is right now that's okay so now the main thing right now is uh both sides both sides are responsible for streaming right and both sides are responsible for like sending the stream and also receiving the Stream so we want to have stream dot receive and stream.send functions uh implement it at both the sites both both the server and the client and uh here we'll say for [Music] and firstly because it's a server it'll be receiving his Stream So stream dot receive let's see your stream right so the first streamer receive will be a request so we'll use the request variable [Music] standard stuff check for end of file tunnel handle the error if there is not good nil return errors [Music] okay still we don't have PB here I'll go and get it from here [Music] so log dot and Def [Music] got request with name percentage V comma Quest dot name [Music] right and response will be PV dot hello response which is our struct [Music] and message we'll add a hello there and then we'll basically add a hello to the request.name right so we get a request as a stream and the request is going to have names so that's why it's we're running a for Loop we can go through the request names one by one and keep adding a hello to it then we'll say dream dot send the response right so create a response and then send that response [Music] okay so this is yours um bidirectional streaming for at the server side really straightforward and we need the same for the client side as well so let's say bye stream dot go and here is where we'll create the function which our main file is waiting for so first let's start with package Main then we'll import a couple of things including PV but most importantly we'll say funk call say Hello by national string I think that's the function that this is waiting for right and take some client people be great service [Music] client and names which is PV Dot names list then then you have so just like we did with the all the other streamings we'll print out add the client side that hey bi-directional [Music] streaming has started [Music] and you'll click line dot say Hello by Direction streaming to be able to call that function and context.background foreign handle the error here itself [Music] could not send names [Music] okay so uh from the client side we want to send a stream uh and we want to also receive a stream but we're calling the function uh at the server side which is say hello um bi-directional streaming this is the function so it's a remote procedure call okay so you want to send a stream and also receive a stream now to do all of that we'll use channels so create a channel [Music] and we'll create one routine first so go funk foreign will say stream dot receive so this is for receiving our stream from the server [Music] [Music] okay then let's handle the error if it's not in a file then let's handle the error some error while streaming and print out the exact error here and print out the message [Music] then you close wait C which is your channel close the channel and this is your [Music] routine okay this is a good routine for yours uh okay yeah so I see this issue here is because it should be a round bracket so now you're able to receive uh the stream and do something with it you're able to print out that message uh okay now you'll create another for Loop here so far [Music] name and you'll range over the names [Music] and you'll create a request pv.hello request and we know that the name the hello request is basically a struct which requires name requires name with a capital N and we are passing name with a small n from here name which will be going over the names and then getting each name one by one and then creating a request object from it and you know that we want to receive and send so it'll have to both the functions just like our server had it was receiving and sending this our client is also the same uh to be able to send the request to the client it's going to have stream Dot stand and it's basically sending a request which is going to have names and sending it one by one that's why we have the for Loop okay header [Music] stream dot send for request handle the error here itself log dot fatal f error while sending the request [Music] okay and then you know that there is a delay of two seconds because we want to simulate what it would look like to actually stream a lot of data and then you'll have stream Dot close send [Music] and log printf by sorry it all looks out of whack a lot Dot printf by directional streaming finished all right here is this is a small typo should be send now everything looks okay so we want to just go ahead and save our main.co also and try out the bi-directional streaming so I'll open up my two terminals I'll say go run star.co here for the server go run start dot go here for the um client [Music] here you can see it says hello kill hello Alice and hello Bob is not showing here because when I refresh the terminal hello Bob and pedation streaming finished okay that's what we wanted to print both sides streaming is happening so that's what you want to print in our client and we'll stop this over also so this is it guys this was the entire project uh I'll just go over everything very fast quickly so that you have an idea so we started with our main.go file for Server where we created our port and our hello server struct and our func main which started the server then we have a client which is also a goal line server which basically calls the uh calls.grp server with the help of grpc dial function on that particular port on which the server the grvc server is running and we usually pass our names either as a request or as a um stream right as a regular request or a stream which is a request and then you have uh all of these functions one is the regular unary API function one is the server stream function client stream function and bi-directional stream function all these functions so we kept commenting them out to see to demonstrate each of these functions and for each of the functions at the server side and at the client side we have different files so this really organizes our project really well so for Unity API call we have a very simple function the server side and a very simple function in the client side as you can see see right just sends a question gets a response then we implemented server stream from our server side where we said that the server will request receive a request okay which was just a names list and it'll go over those names and it'll send a stream to the client and they'll also be delay of two seconds when sending that stream okay so that's why you use the string.send function now in the client side for Server streaming we're just sending uh the the names list and we are then receiving the stream right so you need some logic to receive the stream and also to check the stream has ended so that's why there's an end of file uh logic here and then you type out streaming finished then for then we implemented plant streaming for clan streaming uh by the way in uh all in between we also created these files based on the uh protophile so we created in the beginning itself the grid protofile which is your like your contract for the functions the RPC functions that will be happening remote procedure call basically Works in a way that the client directly calls the functions at the server side so you have to define those RPC calls the first is the unary then the servers client and then the clan streaming and the buy Direction streaming and we have defined what all they accept so this accepts no parameters returns a response this accepts a name list returns a stream this accepts a stream returns a message list then this accepts stream returns a stream so all of those things also have been defined out here properly and then we created these two files with that protoc command these two files are created automatic likely for us so coming back to the client stream for the client stream in our server side we know that we have to receive a stream because the client is streaming right so we'll have the same logic that we had in the at the client side and for for Server streaming we'll have the stream receive we'll have the end of file checking we'll have the error checking and we'll just append to messages and we'll just print out the stuff that's it that's it at the client's client stream uh we have the ability to send that stream to the server so we have stream.send and we also have a delay of two seconds and we want to print out everything that we can get back uh from the the response that we get back from the server we want to print that out here for bi-directional streaming we have both the ability to receive as well as send the you know stream to the front end and the front end which is the client we have our uh you know ability to call the function then we created a channel and then we had the ability to receive the stream and also to send a stream as a request now this means that all of the micro Services right so if you if you want to have interactions between microservices you will be using grpc right that is one way uh the other way is to use Kafka so I'll show you that also in the future so the one way which is we're using which is a remote procedure call you create a client and a server on one microservice also you create another client server on another microservice and then they start interacting with each other or you can just feel or you can just create like one client only at a microservice and just a server only at microservice you can do that also depending on what you're trying to implement okay so this was a really really great uh project guys we've built something nice okay here but this demonstrates those four types of streaming four types of rpcs okay in the next project uh which we'll build with grpc uh like whenever it comes out because there could be different projects that come out for golang and Trust in between right so whenever the grpc project comes out we'll build something we'll build a proper crud with grpc and then after that there will be a third project where we'll build something more serious with the database we'll get a database involved so you'll also learn how to use grpc in a microservice but also databases and then once you've used like once you've built grads once you've built like uh you know use used databases and all then is the right time to start working with microservices that's that's when the more advanced projects will start okay so I hope you're getting used to grpc now and uh in the future I also have some projects coming up with graphql like a complete full-on project with graphql where you have a front end you have a backend in golang database all of that stuff okay so a lot of stuff coming up for golang so if you are not following this channel you should because uh this is like going to be awesome content which you won't find on the internet to be to be honest you can't find it on udemy can't find it on YouTube for sure this content is only there on my channel for now as of now because you know if anybody had this knowledge they would create courses paid courses out of it they wouldn't give it for free right you know you know how it works you know how the industry works right so but I'm giving it up for free because my priority because I make money with something else I have my own companies all right so do subscribe to this Channel and share this with your friends share this with your friends and make sure they also learn and they also get nice jobs that's what will make me really happy thank you guys I'll see you in the next project and keep watching
Info
Channel: Akhil Sharma
Views: 45,798
Rating: undefined out of 5
Keywords:
Id: a6G5-LUlFO4
Channel Id: undefined
Length: 99min 32sec (5972 seconds)
Published: Sun Dec 11 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.