Class: FayeAuthExt
- Inherits:
-
Object
- Object
- FayeAuthExt
- Defined in:
- lib/goshrine_bot/faye_auth_ext.rb
Instance Method Summary collapse
-
#initialize(user_id, token) ⇒ FayeAuthExt
constructor
A new instance of FayeAuthExt.
- #outgoing(message, callback) ⇒ Object
Constructor Details
#initialize(user_id, token) ⇒ FayeAuthExt
Returns a new instance of FayeAuthExt.
2 3 4 5 |
# File 'lib/goshrine_bot/faye_auth_ext.rb', line 2 def initialize(user_id, token) @user_id = user_id @token = token end |
Instance Method Details
#outgoing(message, callback) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/goshrine_bot/faye_auth_ext.rb', line 7 def outgoing(, callback) # Add ext field if it's not present ['ext'] ||= {} # Set the auth token ['ext']['authToken'] = "#{@user_id}:#{@token}" # Carry on and send the message to the server callback.call() end |