Class: WhoIsOnline::PresenceController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/whoisonline/presence_controller.rb

Instance Method Summary collapse

Instance Method Details

#heartbeatObject



18
19
20
21
22
23
24
25
# File 'lib/whoisonline/presence_controller.rb', line 18

def heartbeat
  user = resolve_whoisonline_user
  WhoIsOnline.track(user) if user
  head :ok
rescue StandardError => e
  WhoIsOnline.configuration.logger&.warn("whoisonline heartbeat failed: #{e.class} #{e.message}")
  head :ok
end

#offlineObject



9
10
11
12
13
14
15
16
# File 'lib/whoisonline/presence_controller.rb', line 9

def offline
  user = resolve_whoisonline_user
  WhoIsOnline.offline(user) if user
  head :ok
rescue StandardError => e
  WhoIsOnline.configuration.logger&.warn("whoisonline offline failed: #{e.class} #{e.message}")
  head :ok
end