Skip to content
Paras Gupta

April 6 - Daily Programming Diary

Diary, Programming1 min read

9:00

I have to work on the Talk to professional feature on the Raahee website and have a deadline to stick to. I'll just be creating a bad UI for now with a list of professionals and then a chat box.

11:00

Okay! Been hammering my keyboard, Googling for possible errors, and banging my head on the wall for the last 2 hours only to realize that the Auth token is invalid, and that the server documentation is crap. My head hurts.

But, on the flip side, majority of the work is done. The socket object is provided by the React context API for each component, making it easy for reusing single instance. The connect code is working alright, and the listeners have been added. The only thing left to do is possibly to integrate the Razorpay before payment, and making a call to MHP.

I'ma take a break now.

12:00

Okay, yeah. Server code needs to be changed to work with React. :facepalm:
Turns out, the default transport used when making a socket-io request is websocket and sending extraHeaders is not possible. WOW!

12:30

While waiting for the server code to update, I am currently testing in Firefox. I was able to establish the connection and was able to finally listen to socket events. Phew!

13:00

Turns out the server is not doing what the documentation says at all. The features have not been pushed to the server and I'm expected to use them to build the app.

14:00

Started the development server to do the work quickly. Done with the basic requests to send requests and cancel.

15:00

Things got a little of of hand when trying to test the app with the MHP side of socket. At first, I thought and I wanna curse myself for that, that since the database is shared, the sockets would be shared. Of course that isn't true!

Anyway, when I changed the the sample code to the ngrok server. Everything worked. Now all there's left to do is the chat feature. That would be easy. Just listen for the messages and check if the message was sent by the current user or the other user, and display accordingly. Yay!

Will fix the minor things when integrating the frontend since it's bound to break stuff. Let's see.

Time for a break

EOD Checklist

  • Raahee
  • Leetcode April Challenge
  • This blog
© 2022 by Paras Gupta. All rights reserved.
Theme by LekoArts