Module: P2pStreamsChannel::TagHelper

Defined in:
app/helpers/p2p_streams_channel/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#p2p_frame_tag(session_id:, peer_id:, **params, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/p2p_streams_channel/tag_helper.rb', line 4

def p2p_frame_tag(session_id:, peer_id:, **params, &block)
    session = P2pStreamsChannel.fetch_session(session_id, **params)
    signed_stream_name = Turbo::StreamsChannel.signed_stream_name(session)
    content = capture(&block)

    %(
        <p2p-frame channel="SignalingChannel" signed-stream-name=#{signed_stream_name} 
            session-id=#{session.id} peer-id=#{peer_id.to_json} params=#{params.to_json}>
            #{content}
        </p2p-frame>
    ).html_safe
end