impl chat logic
add mnesia support