Trying to figure this out

For next.js use getServerSideProps, which builds the pages on the fly.

About socket.io, you want actually to make seamless updates on the page without refreshing it or why do you need sockets here?