test post

by Alex Freshmann
test post
module ApplicationCable
  class Connection < ActionCable::Connection::Base
    identified_by :user_id

    def connect
      authenticate!
    end

    private

    def authenticate!
      User::Cmd::CheckAuthToken.new(request.params)
        .on(:ok) { |user|
        self.user_id = user.id
        binding.pry
        Binance::Api::Configuration.api_key    = user.auth['api_key']
        Binance::Api::Configuration.secret_key = user.auth['api_secret']
      }
        .on(:error) { reject_unauthorized_connection }
        .call
    end
  end
end
April 28, 2018by svezhak
0

Share to Facebook