Sha256: 720c1b1fbcebfd5843d28a4d838ec00e0ca331db8a6d563c63ff450cd3e96b90

Contents?: true

Size: 374 Bytes

Versions: 9

Compression:

Stored size: 374 Bytes

Contents

class FayeAuthExt
  def initialize(user_id, token)
    @user_id = user_id
    @token = token
  end
  
  def outgoing(message, callback)
    # Add ext field if it's not present
    message['ext'] ||= {}

    # Set the auth token
    message['ext']['authToken'] = "#{@user_id}:#{@token}"

    # Carry on and send the message to the server
    callback.call(message)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
goshrine_bot-0.2.0 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.13 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.11 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.10 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.9 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.8 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.7 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.6 lib/goshrine_bot/faye_auth_ext.rb
goshrine_bot-0.1.5 lib/goshrine_bot/faye_auth_ext.rb