Class: Primer::RealTime::ServerAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/primer/real_time.rb

Instance Method Summary collapse

Instance Method Details

#incoming(message, callback) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/primer/real_time.rb', line 10

def incoming(message, callback)
  channel = message['channel']
  return callback.call(message) if Faye::Channel.meta?(channel)
  
  password = message['ext'] && message['ext']['password']
  unless password == RealTime.password
    message['error'] = Faye::Error.ext_mismatch
  end
  
  message['ext'].delete('password') if password
  callback.call(message)
end