2 - WebSocket client implementation in ESP IDF FreeRTOS for ESP32

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello we continue our video serial for the websocket and in previous video we talked briefly about the possibility in postman to check the server to ensure that the websocket connection is working a very simple and short video in this video we will implement the connection of the client on the esp32 via websocket to the server of postman that we have checked in the previous video and okay in order to do so we will have our code but first and how we started to deal with this problem of course we're always starting in in the expressive site and on the expressive side they have asp websocket client explanation which is relatively brief and have on mostly the data for different functions as well they have a pretty good example which is right here protocols websocket this is example for the websocket client if we look here it's relatively simple but still from my opinion difficult to understand example and like always in on our site we simplified as much as possible in order to be to to make it more understandable so in our get heap repository websocket is pidf inside the sims iot devices we have the following code we have we have the following files one of which is my data where you should put your wi-fi and wi-fi password credentials and the other one is the project itself here inside sims iot devices web sockets project dot c approach 2.c and we copied this file inside our editor and here you have it let's go over briefly what we have here the includes with esp websocket client header we define the appropriate tag here we use two functions which we explained in our previous videos regarding the wi-fi connection establishment it is wi-fi handler and wi-fi connection those those functions using my data with a proper credentials the websocket connection have two functions a websocket event handler and a web socket definition function where the main and have only three lines the establishment of wi-fi connection we give enough time for wi-fi connection to take place and then we're up we run the websocket application and inside the web websocket application we define the connection and please note that this is the link that was checked via postman in the previous video and we we were sure that this link is working we're sending data to this server via websocket connection and this server is echoing back the data and we refer the websocket connection to the websocket handler to this one websocket handler and then we start the connection and start sending hello one two three four and so on and we expect to receive back the same data let's run it meanwhile we will go over the handler in the handler you have we have two uh situation because we deleted the other situation in sake of simplicity we write when the socket is connected and then each time we write the data that were received remember we are sending hello one two three and so on so let's see how it works okay now wi-fi is connected we got the ip web socket event connected we send hello zero hell bend received hello zero and after 10 instances websocket is stopped and let's connect it to the code websocket connected event we have here we are sending we are sending the hello one two three and so on and we received received here in websocket event data we received the data exactly the same data which we have sent this string with appropriate number after the completion of 10 loops the websocket connection is terminated and we print the websocket is stopped you have it here that's it thank you
Info
Channel: SIMS IOT Devices
Views: 6,681
Rating: undefined out of 5
Keywords:
Id: 19yeTK8_ko4
Channel Id: undefined
Length: 6min 30sec (390 seconds)
Published: Fri May 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.