stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

10h 5m 42s logged

Devlog - 7

Another Long Devlog Time

So I was setting up my project to be deployed on the nest container that I have since nest only gives public ipv6 I couldn’t host my nextjs app on vercel because then I wouldn’t have been able to connect to my postgres database which was on nest as vercel dont have ipv6 support so I moved my nextjs to nestjs and It caused me hell lot of problems and bugs.

  • First of all had to make sure nextjs, postgres and socket server were running on same docker network.
  • My nest container was crashing when building the nextjs for docker.
  • Had to move building process to my laptop then push the image to ghcr.io
  • And some silly mistakes that took me long time to fix.

Lets talk about the project what I update in that

  • So first of all made a presence for managing friends online status.
  • Added logic to connection and disconnection events of player socket. As when players connects through socket it should know whom his friends and what friend requets he got and what friends are currently online and also if he is reconnecting (For now 1minute reconnect window) the socketId should be updated in the needed area (room and player redis store).
  • When the socket disconnects, set the socketId in player redis store to null . After the reconnect window is over check if he is in a room, if yes remove him from the room and in both cases delete the player record from redis .
  • Also lets expand on connection syncFriends the socket requests data from an internal api route only accessible through the socket for what friendship records are there and formats it in
  friends: [], 
  requests: [
    incoming: [], 
    outgoing: []
  ]

Then socket server retrieves all the playes using their playerid from redis via mget and then returns the same object structure but in friends its adds a online: true/false to the player objects

  • Also removed polling for friendships as now socket does them all. So there is less db calls now.
  • Fixed few bugs too.

Now let me tell you a funny story. When testing stuff in prod, I was confused why stuff wasn’t working because it was working fine during development then i remembered I didn’t update the .env file in prod. It may have cut some years from my lifetime.

0
44

Comments 0

No comments yet. Be the first!