Facebook does not close the session with your website. You should think of it as a “session per request”. In other words, you need to implement a simple structure in memory for storing data about conversations - it is recommended to store the key value using the sender ID as the key. You can also use redis for this task.
source
share