How to get realtime message number and online user?

Hello

How to get realtime message number and online user?