set up action able to work with webrtc in localhost

This commit is contained in:
Beatrice Olivera
2018-08-27 19:05:57 +01:00
parent f9cbb7c680
commit aa3693d58c
9 changed files with 252 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!
protect_from_forgery unless: -> { request.format.json? } # Only accept json
end

View File

@@ -0,0 +1,15 @@
class VideoSessionsController < ApplicationController
def create
# HTTP status code 200 with an empty body
head :no_content
ActionCable.server.broadcast "video_session_channel", session_params
end
private
def session_params
# SDP = Session description protocol (codec info from client)
# Candidate = ICE candidates (e.g. TURN and STUN server)
params.permit(:type, :from, :to, :sdp, :candidate)
end
end