I want to built a feature on my website for a project where a user can see a new post sent to him without refreshing the page.
What i am doing now is that i call a function every second to see whether a new post has arrived or not? But this is not a good programming practice.
Hence my question is that, how do i make it possible for the server to say to the client that a post has been arrived for you. Then only the client should call the function to fetch the post and not every second.
I found some topics here, but were not useful.
Please help me.
Thank You.
What i am doing now is that i call a function every second to see whether a new post has arrived or not? But this is not a good programming practice.
Hence my question is that, how do i make it possible for the server to say to the client that a post has been arrived for you. Then only the client should call the function to fetch the post and not every second.
I found some topics here, but were not useful.
Please help me.
Thank You.
Last edited: