Move get_stats in methods,use it from views,socket

also try to import get_stats from core in socketio
fix typo