Create properties for Call model:
searcher:object
caller_heartbeat: date
searcher_heartbeat: date
In /call/connect, set call.searcher to logged in user.
Create /calls/heartbeat/:id/ remote method and function. On call, lookup logged in user id,
and determine if user is caller or searcher using call.caller.id, or call.searcher.id. Update call.caller_heartbeat or call.searcher_heartbeat accordingly.
Background
Need to disconnect hanging calls. Cannot rely on client side calling a disconnect endpoint.
Idea is to run a cron job, and disconnect calls that expired.
To keep call from expiring, both web app and desktop clients will call a url periodically, perhaps every 30 seconds. Call ID will be passed to get parameter, and endpoint looks up logged in user id.
User id is matched to call.caller.id or call.searcher.id properties, and updates call.caller_heartbeat, call.searcher_heartbeat.
Then cron endpoint runs every 30 seconds, and disconnects calls with either heartbeat that's over a limit, like 45 seconds. Need to close tokbox session, set call.status='Disconnected'
Create properties for Call model: searcher:object caller_heartbeat: date searcher_heartbeat: date
In /call/connect, set call.searcher to logged in user.
Create /calls/heartbeat/:id/ remote method and function. On call, lookup logged in user id, and determine if user is caller or searcher using call.caller.id, or call.searcher.id. Update call.caller_heartbeat or call.searcher_heartbeat accordingly.
Background
Need to disconnect hanging calls. Cannot rely on client side calling a disconnect endpoint.
Idea is to run a cron job, and disconnect calls that expired.
To keep call from expiring, both web app and desktop clients will call a url periodically, perhaps every 30 seconds. Call ID will be passed to get parameter, and endpoint looks up logged in user id.
User id is matched to call.caller.id or call.searcher.id properties, and updates call.caller_heartbeat, call.searcher_heartbeat.
Then cron endpoint runs every 30 seconds, and disconnects calls with either heartbeat that's over a limit, like 45 seconds. Need to close tokbox session, set call.status='Disconnected'
Server side events update all connected desktops.