Skip to content

Instantly share code, notes, and snippets.

@BitOfUniverse BitOfUniverse/users_controller.rb Secret
Last active May 29, 2016

Embed
What would you like to do?
class UsersController < ApplicationController
before_action :authenticate_user!
def stream
@stream = current_user.stream || current_user.create_stream
gon.opentok = opentok_data(@stream)
end
def watch
@stream = User.find(params[:id]).stream
gon.opentok = opentok_data(@stream)
end
private
def opentok_data(stream)
token = OpenTokClient.generate_token(stream.opentok_session_id)
{ sessionId: stream.opentok_session_id, apiKey: Figaro.env.opentok_api_key, token: token }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.