<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Brandon Yee on Medium]]></title>
        <description><![CDATA[Stories by Brandon Yee on Medium]]></description>
        <link>https://medium.com/@yee.brandon.j?source=rss-289bab2cdfff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pBICpKDYc-zyihh1</url>
            <title>Stories by Brandon Yee on Medium</title>
            <link>https://medium.com/@yee.brandon.j?source=rss-289bab2cdfff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:14:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yee.brandon.j/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using WebRTC (via OpenTok) in a React-Redux Project]]></title>
            <link>https://medium.com/@yee.brandon.j/using-webrtc-via-opentok-in-a-react-redux-project-da5fb17bdcbc?source=rss-289bab2cdfff------2</link>
            <guid isPermaLink="false">https://medium.com/p/da5fb17bdcbc</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Brandon Yee]]></dc:creator>
            <pubDate>Tue, 14 Aug 2018 03:28:49 GMT</pubDate>
            <atom:updated>2018-08-14T03:28:49.376Z</atom:updated>
            <content:encoded><![CDATA[<p>WebRTC is a technology built into modern browsers that lets you integrate real-time video and audio conferencing into your web application.</p><p><strong>WebSockets vs WebRTC</strong></p><p>It’s very similar to WebSockets except that WebSockets runs on TCP while WebRTC can be run on either UDP or TCP. This distinction is important because TCP gives data guarantees (like packets arriving in the order they are sent and if they don’t arrive, the packets are retransmitted, etc) that come at the price of transmission performance. When you’re trying to do real-time teleconferencing, your main concern is having a smooth, lag-free stream. You don’t necessarily care that every bit of audio is crystal clear or that every video pixel is perfectly rendered if the trade-off is a laggy stream. That’s why we want to use UDP instead of TCP.</p><p><strong>Getting Started</strong></p><p>Now that we have a basic idea of why we’re using WebRTC for teleconferencing instead of WebSockets, let’s get started with integrating WebRTC into a React-Redux project!</p><p>I chose to use the OpenTok library for WebRTC because among the half dozen other libraries I checked out, OpenTok seemed to be the best supported, and I’ve also seen other people use it with success. I heard using WebRTC directly can be complex and error-prone, and WebRTC does require a third-party to setup the handshake connection between two parties so that’s why I wanted to look for a library that would save me from avoidable headaches.</p><p>We’ll get started by having a web page access your webcam and display the video stream on the page. It’s very simple:</p><p>1. Go to the OpenTok website and register an account. You’ll receive an API Key that you’ll need to use the service.</p><p>*At the time of this writing, you’ll receive $10 in free credits to stream your video/audio through their system. But you can also choose to enable peer-to-peer streaming which shouldn’t use your credits. So don’t be scared off by the payment aspect. It’s optional.</p><p>2. Use the Server API to generate a Session. You can think of a Session as basically like a chat room. Clients that connect to the same Session will be able to share their video/audio streams with one another.</p><p>3. Use the Server API to generate a Token for each participant in the Session.</p><p>4. Have each client use the APIKey, SessionId, and Token to publish their stream. They will then listen on the Session for others that are publishing their streams.</p><p>5. The client will specify where to display their own published stream on the web page as well as where to display the streams of others in the Session. This will be done via DOM element replacement.</p><p>The tricky part now is dynamically customizing the position and rendering of the streams based on the state of your React app. This requires breaking out of React’s Virtual DOM and manipulating the DOM directly through the use of React Refs. I’ll cover this in a future article.</p><p>*Note this article is a work-in-progress.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da5fb17bdcbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>