Anyway to hook into livequery events like "disconnected" from cloud code or jobs?

I’d like to be able to hook into the live query events from the cloud code side and update a user’s status to disconnected when they lose live query connection.

I assume this isn’t possible at all?

Currently I’m building a more “hacky” way with a lot more overhead to achieve the same goal. Basically I’m updating a “lastConnected” date field in a Status class with the current date every 5 minutes and I have a job that fires every minute to check if that lastConnected date value is more than 5 minutes ago and if so updating the status to disconnected.

Parse.Cloud.onLiveQueryEvent(({
  event,
  client,
  sessionToken,
  useMasterKey,
  installationId,
  clients,
  subscriptions,
  error
}) => {
  if (event !== 'ws_disconnect') {
    return;
  }
  // Do your magic
});

if your ws disconnect you can change the users status offline

I can use this “IN” a cloud code function? (not from the client side)

this is for server side and why you didnot use and update user status in livequery event because you say when they lose live query connection ?

Because if a browser is closed there’s no way to fire a JS function back to Parse saying the user is leaving

Livequery options includes this option.
websocketTimeout Number Number of milliseconds between ping/pong frames. The WebSocket server sends ping/pong frames to the clients to keep the WebSocket alive. This value defines the interval of the ping/pong frame from the server to clients, defaults to 10 * 1000 ms (10 s).

Parse.LiveQuery.on('close'||"error", () => {
  console.log('socket connection closed');
});

Did you try, if not work this is a issue for parse ?