The Red Matrix
 All Classes Namespaces Files Functions Variables Pages
ping.php File Reference

Functions

 ping_init (&$a)
 do several updates when pinged. More...
 

Function Documentation

ping_init ( $a)

do several updates when pinged.

This function does several tasks. Whenever called it checks for new messages, introductions, notifications, etc. and returns a json with the results.

Parameters
App&$a
Returns
JSON

If you have several windows open to this site and switch to a different channel in one of them, the others may get into a confused state showing you a page or options on that page which were only valid under the old identity. You session has changed. Therefore we send a notification of this fact back to the browser where it is picked up in javascript and which reloads the page it is on so that it is valid under the context of the now current channel.

Send all system messages (alerts) to the browser. Some are marked as informational and some represent errors or serious notifications. These typically will popup on the current page (no matter what page it is)

Update chat presence indication (if applicable)

Chatpresence continued... if somebody hasn't pinged recently, they've most likely left the page and shouldn't count as online anymore. We allow an expection for bots.

Everything following is only permitted under the context of a locally authenticated site member.

Handle "mark all xyz notifications read" requests.

URL ping/something will return detail for "something", e.g. a json list with which to populate a notification dropdown menu.

Normal ping - just the counts, no detail