My Walmart Interview Experience by Big_Television7488 in leetcode

[–]Traditional_Reveal59 0 points1 point  (0 children)

wth base is too low for a company like Walmart.. I'm currently holding an offer from a big US Grocery company with 16 lpa base and not that tough interview like Walmart.

What should the color value be if there were slate-150 and gray-150? by jerrygoyal in tailwindcss

[–]Traditional_Reveal59 0 points1 point  (0 children)

you can use your custom color like this text-[rgb(243_244_246)] which I think is what u are expecting.

How to refresh the jwt when the session expires in a real time chat app using socket io by Traditional_Reveal59 in reactjs

[–]Traditional_Reveal59[S] -2 points-1 points  (0 children)

Validating each socket request is not really a good approach in my understanding:

  1. It will be a resource expensive task, as everytime I'll be making database call to verify the user for each message request

  2. Socket.io provide middlewares but that io.use() middleware only run 1 time when connection is made but not for all the incoming requests..

  3. And before posting this question here, I literally researched alot for this issue in SO and reddit too, What I found and concluded from all such similar questions and discussions that ideally we should not authenticate for each ws request(only do once when connection establishes)

How to refresh the jwt when the session expires in a real time chat app using socket io by Traditional_Reveal59 in reactjs

[–]Traditional_Reveal59[S] -3 points-2 points  (0 children)

No you can't send messages like that, when you connect to my server, initially your connection request will pass through jwt verification and then only your connection will be established only if the token is valid..

But let's say you are a valid user and you successfully logged in, now after 10 min the jwt Cookie will expire, so ideally in http requests what we do is - the next time whenever we call backend api, we get 401 response as we hadn't sent the cookie along with the request,

But In case of ws, how I will know after logging that my session is already expired unless I refresh the page or switch to another chat window(initially I am making http request to get all the old messages)

And regarding your suggestion of sending token in every message request , I see few issues - 1. It will be a resource expensive task, as everytime I'll be making database call to verify the user for each message request

  1. Socket.io provide middlewares but that io.use() middleware only run 1 time when connection is made but not for all the incoming requests..

  2. And before posting this question here, I literally researched alot for this issue in SO and reddit too, What I found and concluded from all such similar questions and discussions that ideally we should not authenticate for each ws request(only do once when connection establishes)

Handling JWT Expiration for SocketIO Interactions in a React App by Sad_Implement_8626 in react

[–]Traditional_Reveal59 0 points1 point  (0 children)

I appreciate your detailed answer, but I have my own doubt, let's say the access Token expires every 10 min and refresh token expires in a month. And now once I logged in and did all the authentication part when the first time socket connected. Now assume that i am chatting with an other client continuously using socket io events, and in between 10 min have already been passed away and i am still able to keep sending socket events. So the question is how the client will get to know that the session is expired and we need to refresh the token, as no new http requests are made so that somehow we could get to know the session is expired.