<?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 Furkan Can Baytemur on Medium]]></title>
        <description><![CDATA[Stories by Furkan Can Baytemur on Medium]]></description>
        <link>https://medium.com/@furkancanbaytemur?source=rss-2eb59b22e355------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JI-heAE7Tlkep7VDwbHzNQ.jpeg</url>
            <title>Stories by Furkan Can Baytemur on Medium</title>
            <link>https://medium.com/@furkancanbaytemur?source=rss-2eb59b22e355------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 15:19:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@furkancanbaytemur/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[Alamofire: A Quick Guide]]></title>
            <link>https://medium.com/orion-innovation-techclub/alamofire-a-quick-guide-4edb0d182a3b?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/4edb0d182a3b</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[techclub-tr]]></category>
            <category><![CDATA[network]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Fri, 31 Mar 2023 23:18:56 GMT</pubDate>
            <atom:updated>2023-03-31T23:18:56.195Z</atom:updated>
            <content:encoded><![CDATA[<p>In your mobile development journey, you will surely encounter some apps that require you to make network requests. Network requests are a crucial step in improving your knowledge of mobile development. If you are an iOS developer like me, then you need to learn Alamofire to make your network requests.</p><blockquote>Elegant Networking in Swift</blockquote><p>As their motto says, Alamofire makes network requests as gracefully as possible. It is written with Swift for meeting the needs of iOS developers. It can also be used for macOS if the application is powered by Swift. Providing a clean and elegant API, Alamofire is a popular tool to handle HTTP requests. You can easily make asynchronous network requests, upload and download files, and integrate with OAuth and other authentication mechanisms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XZzrZSvuSJ002zqh" /><figcaption>Photo by <a href="https://unsplash.com/@fernanddecanne?utm_source=medium&amp;utm_medium=referral">Fernand De Canne</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In addition to its elegance, Alamofire is very flexible. It can be used in a simple app like a weather app or a complex app like inventory tracking for a company.</p><p>In this article, we will be making a simple movie application to see how to install Alamofire and make network requests with it.</p><h3>Installing Alamofire</h3><p>There are many ways to install Alamofire to your project like Carthage and Swift Package Manager. In this article, we are going to focus on CocoaPods.</p><p>First of all, create a new iOS project in XCode. Don’t forget to choose SwiftUI as the Interface option. Before writing any code to our project, let’s add Alamofire as a Pods package. Open your project folder in Finder. You should be seeing the project folder and <em>xcodeproj</em> file. Here, open a terminal page and write this command to initiate Cocoapods.</p><pre>pod init</pre><p>Now you will see a new file named <em>Podfile</em>. Open it in a text editor and add Alamofire like this:</p><pre># Uncomment the next line to define a global platform for your project<br># platform :ios, &#39;9.0&#39;<br><br>target &#39;AlamoMovie&#39; do<br>  # Comment the next line if you don&#39;t want to use dynamic frameworks<br>  use_frameworks!<br><br>  # Pods for AlamoMovie<br><br>    pod &#39;Alamofire&#39;<br><br>end</pre><p>Since we can use the latest version, we didn’t include a version number for Alamofire. After saving the file, write this command to the terminal to install Pods project with Alamofire.</p><pre>pod install</pre><p>After installation is completed. You will see new files added to the project. The important one is <em>xcworkspace</em> file. Having installed Cocoapods, you need to close your Xcode project and open the workspace file since there is a new project named Pods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*BSlKCxY-nGsaRGzdOKG9Bw.png" /></figure><p>When you open the workspace file, you need to see a project structure like above. Check that Pods folder has Alamofire in it. We have installed Alamofire successfully. Let’s continue with designing our UI.</p><h3>Designing our App</h3><p>In this app, we will list the top-rated movies of all time by. Our UI will be designed with SwiftUI and show a list of components that will feature the main properties of a movie. Firstly, let’s design our movie cell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*H385DQFiU3Rdgpvvb-QYVQ.png" /></figure><p>For designing this component, we need variables for a title, release year, rating and motto of the movie.</p><pre>struct MovieCell: View {<br>    let title : String<br>    let rating : Int<br>    let ratingColor : Color<br>    let motto : String<br>    let imageURL : String<br>    <br>    init(title: String, year: String, rating: Int, motto: String, poster: String) {<br>        self.title = &quot;\(title) (\(year))&quot;<br>        <br>        self.rating = rating<br>        self.ratingColor = rating &gt; 79 ? Color.green : rating &gt; 49 ? Color.yellow : Color.red<br>        <br>        self.motto = motto<br>        self.imageURL = poster<br>    }<br>}</pre><p>We have an additional variable named <em>ratingColor</em>. It will be used to change the color of the rating text based on the formula written in the <em>init</em> function. We only have the URL of the image, we will be rendered as an image using the AsyncImage struct which is introduced in iOS 15.</p><pre>var body: some View {<br>        HStack {<br>            AsyncImage(url: URL(string: imageURL)) { image in<br>                image<br>                    .resizable()<br>                    .aspectRatio(contentMode: .fit)<br>            } placeholder: {<br>                Color.gray<br>                    .frame(width: 100)<br>            }<br>                <br>            VStack(alignment: .leading) {<br>                Text(title)<br>                    .font(.title3)<br>                    .fontWeight(.medium)<br>                <br>                Divider()<br>                <br>                HStack {<br>                    ZStack {<br>                        Circle()<br>                            .stroke(ratingColor, lineWidth: 4)<br>                        Text(&quot;\(rating)&quot;)<br>                            .foregroundColor(ratingColor)<br>                    }<br>                    .frame(height: 30)<br>                    <br>                    Text(motto)<br>                        .font(.callout)<br>                        .italic()<br>                }   <br>            }<br>        }<br>        .frame(height: 150)<br>        .frame(maxWidth: .infinity, alignment: .leading)<br>    }</pre><p>We place our components in a HStack to place them horizontally to each other. The first component is the poster of the movie which is placed with AsyncImage struct. We convert imageURL to URL since AsyncImage constructor accepts a URL variable. We also put .resizable and fit aspect ratio to make the poster conform to the height of the cell. As a placeholder, we use gray color if the image is still loading.</p><p>After the poster, we place a VStack to list our other properties. For the title, we are using a Text component with <em>title3</em> font and medium font weight. We place a divider before other elements to make the title a bit more enhanced.</p><p>For our last two elements, we use an HStack. Firstly, we are designing a rating component which is just text inside a circle. To design it, we used a ZStack and placed a circle alongside the text itself.</p><p>Lastly, we use a Text component with the italic font to showcase the motto of the movie. And, we have designed our movie cell. As the next step, let’s make the network requests to get these properties from our API.</p><h3>Making Requests</h3><p>We will be using TMDB to get movie features. TMDB stands for “The Movie Database”. It is an online database that provides information about movies, TV shows, and other types of content related to the entertainment industry. The database contains information about cast and crew, plot summaries, ratings, and other details related to movies and TV shows.</p><p>We will follow these steps to get our features:</p><ul><li>Make a request to get top-rated movies</li><li>Decode request to get IDs of movies</li><li>Use these IDs to get more information about movies</li><li>Decode detailed objects to get features of the movie</li></ul><pre>let API_KEY = <br>let topRatedURL = &quot;https://api.themoviedb.org/3/movie/top_rated&quot;<br>let movieDetailURL = &quot;https://api.themoviedb.org/3/movie/&quot;<br>let posterBaseURL = &quot;https://image.tmdb.org/t/p/original&quot;</pre><p>We will be using these URLs to access the API of TMDB. You can get your API key easily by just registering to TMDB for free.</p><pre>class movieList: ObservableObject {<br>    @Published var movieList : [Movie] = []<br>    <br>    init() {<br>        fetchMovies()<br>    }<br>}</pre><p>To store movies, let’s create a class named movieList conforming to ObservableObject. We need a <em>@Published</em> array to refresh our UI as more movies come from the API. Before filling our <em>movieList</em> array, we need to get the IDs of top-rated movies in the <em>fetchMovies(</em>) function which will be executed when we create a <em>movieList</em> object.</p><pre>func fetchMovies() {<br>    AF.request(&quot;\(topRatedURL)?api_key=\(API_KEY)&quot;).response { response in<br>        <br>        guard let data = response.data else { return }<br>        <br>        do {<br>            let jsonObject = try JSONSerialization.jsonObject(with: data)<br>            <br>            if let dict = jsonObject as? [String: Any], let results = dict[&quot;results&quot;] as? [[String: Any]] {<br>                for movie in results {<br>                    if let movieID = movie[&quot;id&quot;] as? Int {<br>                        <br>                        self.fetchMovieDetail(movieID)<br>                    }<br>                }<br>            }<br>        }<br>        catch {<br>           debugPrint(error)<br>        }<br>    }<br>}</pre><p>Firstly, we use the AF object of Alamofire to make the request. The request we need to make is composed of <em>topRatedURL</em> and <em>API_KEY. </em>It will look something like this:</p><blockquote><a href="https://api.themoviedb.org/3/movie/top_rated?api_key=">https://api.themoviedb.org/3/movie/top_rated?api_key=</a>[API_KEY]</blockquote><p>Alamofire will make the request and return us a response object which we will decode. Before making anything, we need to check if the response object has a data member to verify it was a successful request and response has values inside it. After this verification, we can decode our response with JSON serialization.</p><pre>{<br>    page = 1;<br>    results =     (<br>                {<br>            adult = 0;<br>            &quot;backdrop_path&quot; = &quot;/tmU7GeKVybMWFButWEGl2M4GeiP.jpg&quot;;<br>            &quot;genre_ids&quot; =             (<br>                18,<br>                80<br>            );<br>            id = 238;<br>            &quot;original_language&quot; = en;<br>            &quot;original_title&quot; = &quot;The Godfather&quot;;<br>            overview = &quot;Spanning the years 1945 to 1955, a chronicle of the fictional Italian-American Corleone crime family. When organized crime family patriarch, Vito Corleone barely survives an attempt on his life, his youngest son, Michael steps in to take care of the would-be killers, launching a campaign of bloody revenge.&quot;;<br>            popularity = &quot;123.415&quot;;<br>            &quot;poster_path&quot; = &quot;/3bhkrj58Vtu7enYsRolD1fZdja1.jpg&quot;;<br>            &quot;release_date&quot; = &quot;1972-03-14&quot;;<br>            title = &quot;The Godfather&quot;;<br>            video = 0;<br>            &quot;vote_average&quot; = &quot;8.699999999999999&quot;;<br>            &quot;vote_count&quot; = 17586;<br>        }<br>    );<br>    &quot;total_pages&quot; = 544;<br>    &quot;total_results&quot; = 10877;<br>}</pre><p>The JSON object we get will be something like this though it will have more than one movie for sure. As you see, the object has “results” and “page” keys inside it. For our purposes, the first page would be more than enough. The important object we need to get is the values of the “results” key. We transform our JSON object to an array of String keys and Any values since values might have different types. Then, we get values with the “results” key to a variable named <em>results</em>. If all is successful, we got the movies to the object we need. We open a for loop in the <em>results</em> array. The only thing we need from this object is the IDs of movies. So we get these IDs with the “id” key. Lastly, we execute a function named <em>fetchMovieDetail</em>. This function will make another request to get details of each movie. Let’s examine this function.</p><pre>func fetchMovieDetail(_ ID: Int) {<br>    AF.request(&quot;\(movieDetailURL)\(ID)?api_key=\(API_KEY)&quot;).response { [self] response in<br>        guard let data = response.data else { return }<br>        <br>        do {<br>            let jsonObject = try JSONSerialization.jsonObject(with: data)<br>            <br>            if let movieDetail = jsonObject as? [String: Any] {<br>                <br>                let title = movieDetail[&quot;original_title&quot;] as? String<br>                let poster = movieDetail[&quot;poster_path&quot;] as? String<br>                let date = movieDetail[&quot;release_date&quot;] as? String<br>                let motto = movieDetail[&quot;tagline&quot;] as? String<br>                let rating = movieDetail[&quot;vote_average&quot;] as? Double<br>                <br>                let movie = Movie(title!, motto!, poster!, date!, rating!)<br>                <br>                movieList.append(movie)<br>            }<br>        }<br>        catch {<br>            debugPrint(error)<br>        }<br>    }<br>}</pre><p>In here, we make another request to TMDB API to get details of the movie. We use a different URL this time:</p><blockquote><a href="https://api.themoviedb.org/3/movie/?api_key=">https://api.themoviedb.org/3/movie/?api_key=</a>[API_KEY]</blockquote><p>After making similar arrangements and transforming the JSON object to a key-value array, we can get the details that we need. We can simply create some variables and assign them respective details we can get from the JSON object. Be sure to write the correct keys for these details otherwise it would create a blank variable. With these variables at our disposal, we can create a <em>Movie</em> object and append it to the movieList array. Let’s examine the Movie structure to see how we are defining our movie objects.</p><pre>struct Movie: Hashable {<br>    let title: String<br>    let motto: String<br>    let poster: String<br>    let rating: Int<br>    let year: String<br>    <br>    init(_ title: String, _ motto: String, _ posterPath: String, _ date: String, _ rating: Double) {<br>        self.title = title<br>        self.motto = motto<br>        self.poster = &quot;\(posterBaseURL)\(posterPath)&quot;<br>        self.rating = Int(rating * 10)<br>        self.year = String(date.prefix(4))<br>    }<br>}</pre><p>As you can see, the Movie object consists of details that we get from the API. It conforms to Hashable because it will be needed to render our List on the screen. We need some modifications for some variables.</p><p>Since API only provides the back path for the movie poster, we need to insert base URL for the poster. If you try to go to URL below, you will see the poster of The Godfather movie.</p><blockquote><a href="https://image.tmdb.org/t/p/original/3bhkrj58Vtu7enYsRolD1fZdja1.jpg">https://image.tmdb.org/t/p/original/3bhkrj58Vtu7enYsRolD1fZdja1.jpg</a></blockquote><p>Similarly, we use back path of other movies to get all posters in our list. For rating, we use a little calculation. Let’s see it in an example by using The Godfather’s rating.</p><pre>8.712 * 10 -&gt; 87.12 | Int(87.12) -&gt; 87</pre><p>We multiply it by 10 to make a rating out of 100 instead of an out of 10. Then, we convert it to an integer to get rid of decimal points. Lastly, We only get the first 4 characters of the date to only extract the year.</p><pre>&quot;1972-03-14&quot;.prefix(4) -&gt; &quot;1972&quot;</pre><p>We are almost done. We made all the requests to our API and saved them in an array. Let’s add our last code to <em>ContentView</em> to complete our app.</p><pre>struct ContentView: View {<br>    @ObservedObject var movies = movieList()<br>    <br>    var body: some View {<br>        VStack {<br>            List {<br>                ForEach(movies.movieList, id: \.self) { movie in<br>                    MovieCell(title: movie.title, year: movie.year, rating: movie.rating, motto: movie.motto, poster: movie.poster)<br>                }<br>            }<br>        }<br>    }<br>}</pre><p>As we defined our array as <em>@Published</em>, we create our movieList object as a <em>@ObservedObject</em> to enable the app to track our object as it updates. In the body, we define a VStack for our baseline. Then we just create a List and render our <em>MovieCell</em> elements with a <em>ForEach </em>method. This ForEach method will be based on our movieList array and it will be updated as our array is updated with requests from the API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EnfBiCcacv1-3Ax9dDAn6w.png" /></figure><p>And, we’re done! We have created a simple movie application. You can scroll in the app to see more movies below.</p><p>I hope you understood how to make requests in Alamofire. The process is very similar for other APIs as well. If you need something else, don’t forget to check out the <a href="https://github.com/Alamofire/Alamofire">documentation</a> of Alamofire.</p><p>If you have any questions, you can reach me on <a href="https://www.linkedin.com/in/furkancanbaytemur/">LinkedIn</a></p><blockquote>Until next time…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4edb0d182a3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orion-innovation-techclub/alamofire-a-quick-guide-4edb0d182a3b">Alamofire: A Quick Guide</a> was originally published in <a href="https://medium.com/orion-innovation-techclub">Orion Innovation techClub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebRTC Demystified — File Sharing]]></title>
            <link>https://medium.com/orion-innovation-techclub/webrtc-demystified-file-sharing-6b2a6023d6d1?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b2a6023d6d1</guid>
            <category><![CDATA[file-sharing]]></category>
            <category><![CDATA[telecommunication]]></category>
            <category><![CDATA[techclub-tr]]></category>
            <category><![CDATA[airdrop]]></category>
            <category><![CDATA[webrtc]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Wed, 23 Nov 2022 05:45:42 GMT</pubDate>
            <atom:updated>2022-11-23T05:45:42.497Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC Demystified — File Sharing</h3><h4>Another Data Channel Usage</h4><p>In the previous article, we implemented a data channel and built a simple chatting window inside our application which is the second functionality of Magny. With that, we have learned:</p><ul><li>Create and listen to a data channel</li><li>Share messages through the data channel</li><li>Add these messages to a chat window</li></ul><blockquote>In this article, we will implement our final functionality: file sharing!</blockquote><p>If we oversimplify, files are long strings. This means that we can share them through the data channel. However, we cannot send them directly as it is. Browsers have a limit of 64KiB (not KB) to send a variable, so we cannot ship most files. To clear this hurdle, we will split files into chunks and send them one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DQxwMrYEesAhSsHeuevGsQ.jpeg" /></figure><h3>UI for File Sharing</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/571f7f06e48ab7917f5db7f863da9405/href">https://medium.com/media/571f7f06e48ab7917f5db7f863da9405/href</a></iframe><p>It would be good to have a file input area that we can drag and drop. It will also feature a loading bar which will be achieved by SVG tag. We will get into the details as we write code in TypeScript.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/361c54d7f44e4a1421005ef56d8abd25/href">https://medium.com/media/361c54d7f44e4a1421005ef56d8abd25/href</a></iframe><p>The result for our file input will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*WMn1z0W2z4YyG3GaNgyZIw.png" /></figure><p>If you want to get your hands with this design, check out the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/19-ui-for-file-sharing">GitHub - OrionInnovationTRTech/magny at 19-ui-for-file-sharing</a></p><h3>Drag and Drop File</h3><p>Before uploading the file, we need to set up a drag-and-drop mechanism. The first thing we need to do is to highlight dropArea when someone drags a file. This highlighting will be done by .highlight class. Create a file named drag.ts and start to write these functions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9aaedb20b9f17b8460e25d2856271d4/href">https://medium.com/media/a9aaedb20b9f17b8460e25d2856271d4/href</a></iframe><p>Since we will use several events, it would be good to write a function that will prevent the default actions of events. As you can remember, this is required to prevent page refresh.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e496a834e9dd15222048b29da8becd7c/href">https://medium.com/media/e496a834e9dd15222048b29da8becd7c/href</a></iframe><p>Using the preventDefaults function, we set all events to prevent default. To do this swiftly, we used forEach . You might be wondering why did we leave a ; sign before the array. This is because it would cause an error if previous statements didn’t have a ; at their end. Normally, Javascript doesn’t require developers to put ; to every line but it is required since the line starts with a bracket.</p><p>dragenter and dragover are used to track if the user has dragged a file while dragleave tracks if dragged file leaves the area. drop also removes the highlight but we will implement more things to it.</p><p>The next thing we shall do is to get the file object when the user drops the file. Add this event listener to dragAndDrop function.</p><pre>dropArea.addEventListener(&#39;drop&#39;, handleDrop, false)</pre><p>Now let’s examine handleDrop function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b0d083689a70b2f2a6a6b69645aca5a/href">https://medium.com/media/6b0d083689a70b2f2a6a6b69645aca5a/href</a></iframe><p>Create a file variable and put it on top of the file as a global variable. We will be storing the file in that variable. handleDrop function will take the file from dragEvent and store it in a global variable. We will also write the name of the file in the drop area to notify the user. Dragging a file will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*f5Ri799TRrIzOdokRhTa0Q.gif" /></figure><p>Notice that we are storing the file and writing it to UI at a different function. That is because there will be another way to upload a file which is by selecting it. The “Choose” word will be a button that will trigger input.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94977277c6d764521b8df55ccb7aebc8/href">https://medium.com/media/94977277c6d764521b8df55ccb7aebc8/href</a></iframe><p>Clicking to “Choose” just triggers the file input. The user now can select the file with the pop-up window. Now, we need to add an event listener to file input when we select a file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b6824f4ed20033b6f942beb702ee42a/href">https://medium.com/media/9b6824f4ed20033b6f942beb702ee42a/href</a></iframe><p>Again, we execute storeFiles function to write the file name and store the file in the global variable. Now that we can get the file in two ways, we can send it to the remote peer. If you missed anything, you can check out the progress from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/25-drag-and-drop-file">GitHub - OrionInnovationTRTech/magny at 25-drag-and-drop-file</a></p><h3>Send the File Name</h3><p>Before sending the file, let’s send the file name to test our data channel since it will be another data channel in addition to the one used for text chatting. To use the file we store, change the global variable like this:</p><pre>export let file : File</pre><p>Go ahead and create a file named file.ts.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9587d3c097bd9dd899f91520a1cbc67e/href">https://medium.com/media/9587d3c097bd9dd899f91520a1cbc67e/href</a></iframe><p>Similar to textChannel , the initiator of the call will create a new data channel named fileChannel . The difference is binaryTypeand onbufferedamountlow . binaryType makes the data channel to be able to send a buffer while onbufferedamountlow will allow us to set limits to our sending speed so that the connection would not fail. We will get into details when we create chunks. You might have noticed that answerFileChannel function is a bit different. We won’t listen for the data channel here because setting up two different ondatachannel listeners for the same connection is not ideal and might not work in the way we intended. So, we will add this function to our already established ondatachannel listener in answerTextChannel function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e5b138d835b6806538dc894ac073d13/href">https://medium.com/media/4e5b138d835b6806538dc894ac073d13/href</a></iframe><p>Since it is a more general function, we changed its name to answerDataChannel . Before configuring the data channel, we check what data channel is it. “textChannel” is the same but “fileChannel” executes answerFileChannel function.</p><p>We just established the data channel but there is no way to send a message. We want the user to be able to send the file when they select a file. To achieve this, add the following line to the end of storeFile function.</p><pre>sendFile.disabled = false;</pre><p>Let’s add an event listener to the button to send the file name in drag.ts file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/285c48aedadc75253144962c5f2cd143/href">https://medium.com/media/285c48aedadc75253144962c5f2cd143/href</a></iframe><p>If you establish the connection and upload a file and press the send function, the other peer will see a log like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*2uVqWX7825oQk8yL2djK6w.png" /></figure><p>This is completely separate from our text channel. Text channel and file channel can now work simultaneously. The next step is to send the file itself. You can check the branch below to see what we have done so far:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/27-data-channel-for-file-sharing">GitHub - OrionInnovationTRTech/magny at 27-data-channel-for-file-sharing</a></p><h3>Sending the File</h3><p>First of all, let’s write a function to send the file that is uploaded.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64e42de6175c74d5ba81c27635e4e263/href">https://medium.com/media/64e42de6175c74d5ba81c27635e4e263/href</a></iframe><p>Since browsers have a limit of 64 KiB to upload, we set MAX_CHUNK_SIZE accordingly. We also defined “EOF” to specify the end of the file transaction. The first thing to send is the file of the name, then the file size. We are not using the size at the moment but it will be required when we set up the progress bar. Since we will slice the file into chunks, we are creating a arraybufferfrom the file. Remember that we set the data channel’s binary type to be arraybuffer .</p><p>In the for loop, we slice the buffer array into chunks with the size of MAX_CHUNK_SIZE . We simply send it and log out of the state of the app for progress. However, we do have an if statement. When we are sending big files, they are not sent immediately. They are kept in the buffer. That is why we look for the bufferedamount . This value is important because the upload speed is different for everyone. If we don’t check this value, bufferedAmount will be exceeded and the app will crash. So, we determined a MAX_BUFFERED_AMOUNT which is %1 of the file size. When it is exceeded, the program waits for the buffered amount to go below the threshold with the help of a promise.</p><p>Lastly, we are sending “EOF” to indicate that the transaction has finished so that the remote peer can wrap up and download the file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/811aff61d8ba470304f02406a61d8016/href">https://medium.com/media/811aff61d8ba470304f02406a61d8016/href</a></iframe><p>To receive the file, we should alter the onmessage part of openFileChannel function. Since we need to get the name and size of the file at first, we declared a tracker named messageType . Since we know the order of the messages, using only numbers would be enough. When we are done with initial messages which are the name and the size of the file, we can begin to get chunks and push them to a buffer array. When we get the “EOF” message, it means that we are done with the transaction and it is time to execute downloadFile function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bef18573c4293fd7be075c7e9f57a48d/href">https://medium.com/media/bef18573c4293fd7be075c7e9f57a48d/href</a></iframe><p>We create a file from the array consisting of chunks. Then we create an anchor element and set its download property as the file name. Since we want this app to function for Safari too, we set URL property as either window or WebKit. Finally, we set it as href of anchor we click on it to download the file. To make the file transfer functional, let’s execute the function when the send button is clicked.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/679ec2a8ad41adba8c922f5e4b789af0/href">https://medium.com/media/679ec2a8ad41adba8c922f5e4b789af0/href</a></iframe><p>With that done, the app is now able to transfer files between peers. Just put your file and click the send button. You can track the progress from Developer Tools. We will be adding the progress bar in the next article.</p><p>You can check out what we have done so far from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/30-send-big-files-by-chunks">GitHub - OrionInnovationTRTech/magny at 30-send-big-files-by-chunks</a></p><h3>Closing the Connection for File Transfer</h3><p>Before we wrap up with file transfer, we need to remove some event listeners so that they wouldn’t overlap.</p><p>Since we need to remove event listeners, we should fix events for drag and drop functionality in dragAndDrop function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb6e491c4c5524f7dba1130649078c76/href">https://medium.com/media/eb6e491c4c5524f7dba1130649078c76/href</a></iframe><p>Since it is not possible to remove anonymous functions (functions defined without a name) we set the class list adding and removing functionalities to separate functions. Now we can remove these listeners one by one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/05912f0a5165f5952c9930dacab2b5b1/href">https://medium.com/media/05912f0a5165f5952c9930dacab2b5b1/href</a></iframe><p>Add these statements to the end of handUp function. We are doing the following things for closing the connection.</p><ul><li>Clearing the file input</li><li>Clearing the file name text</li><li>Removing events for preventDefault</li><li>Removing event listeners for highlighting and unhighlighting</li><li>Removing various listeners for handling functions</li></ul><p>We are now resetting the app along with file transfer elements. You can update your code from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/32-close-connection-for-file-sharing">GitHub - OrionInnovationTRTech/magny at 32-close-connection-for-file-sharing</a></p><p>We have established file sharing successfully. In the next article, we will add a progress bar for file transactions and deploy our app.</p><blockquote>Until next time…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b2a6023d6d1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orion-innovation-techclub/webrtc-demystified-file-sharing-6b2a6023d6d1">WebRTC Demystified — File Sharing</a> was originally published in <a href="https://medium.com/orion-innovation-techclub">Orion Innovation techClub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebRTC Demystified — Text Chatting]]></title>
            <link>https://medium.com/orion-innovation-techclub/webrtc-demystified-text-chatting-385ed0fa5184?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/385ed0fa5184</guid>
            <category><![CDATA[techclub-tr]]></category>
            <category><![CDATA[text-chat]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[telecommunication]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Mon, 17 Oct 2022 11:06:20 GMT</pubDate>
            <atom:updated>2022-10-17T11:06:20.629Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC Demystified — Text Chatting</h3><h4>Implementing data channels for text chatting</h4><p>In the previous article, we implemented the first of three functionalities of the Magny application; video chatting. We have learned the following:</p><ul><li>Creating Offer and Answering</li><li>Signaling with the help of Firestore</li><li>Tracking Connection State</li><li>Closing the Connection</li></ul><p>In this article, we will learn how to open a data channel and how we can use this data channel to transfer text messages to remote peers. Firstly, we will create a text channel window inside our application and we will implement the data channel to make this window a functional chatting window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJ5CdiOHLZuVbhD9kdLAxw.jpeg" /></figure><h3>UI for Text Chatting</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/451254c02401b8b9177b6b281b46d5cc/href">https://medium.com/media/451254c02401b8b9177b6b281b46d5cc/href</a></iframe><p>This is a simple code to add to our chat window. Since .container div has a flex display, this chat box will show in the right section of the page. You might ask why there is a blank #chat-box div in the code. It is our boilerplate to add our messages to show. We will be adding them from JavaScript by DOM manipulation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d586c8fe17da5eb8554a0ceeb06bd1e3/href">https://medium.com/media/d586c8fe17da5eb8554a0ceeb06bd1e3/href</a></iframe><p>Here is the stylesheet for our text chatting elements. The most important features here are that we disabled the display for the scrollbar and gave overflow-y a scroll feature. These tweaks made the chat window embedded in our application. You will see that it is a window that can be scrollable in itself. .talk-bubble will show itself when we implement the DOM manipulation. You check our progress and take a look at the UI from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/11-ui-for-text-chatting">GitHub - OrionInnovationTRTech/magny at 11-ui-for-text-chatting</a></p><h3>Setting up a Data Channel</h3><p>Once we create the connection, we can open a data channel. This data channel can be used to transfer various data such as strings, integers, objects (in JSON format) or even files (in buffer format). In this case, we will be sending and receiving simple strings. Since this is a new feature, let’s create a brand new TypeScript file named text.ts . First of all, import peerConnection from connect.ts</p><pre>import { peerConnection } from &#39;./connect&#39;</pre><p>We will be opening the data channel on both peers as we did for opening the connection. However, most of the code is similar for both peers. Therefore, we shall create a common function for them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9deeef2030a6c167135958673d6f22e/href">https://medium.com/media/e9deeef2030a6c167135958673d6f22e/href</a></iframe><ul><li>This function takes a RTCDataChannel as an argument.</li><li>Then, it enables the message input.</li><li>Message input has an event listener for every key pressed. It is used to check if the input field is empty or not. If it is not empty, we enable the send button. This is done to prevent blank messages from being sent.</li><li>Lastly, it adds an event listener to the form’s submit event which takes the value from message input and sends it to the remote peer. It executes the createBubble() function and clears the input. Since sending a message is not included in keyup event of the input field, we disable the button.</li></ul><p>Let’s see what createBubble function does:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0927262b31e3944ace02c7fe1304f0c/href">https://medium.com/media/b0927262b31e3944ace02c7fe1304f0c/href</a></iframe><ul><li>It takes the message and a boolean value as parameters. The boolean value determines if the sender is us or not.</li><li>As you can remember, we have written some style sheets for bubbles. We create a div with talk-bubble class and add another class according to the parameter boolean value. If it is a message sent from us, we put it to right; if it is a message incoming from a remote peer, we put it to the left of the chat window.</li><li>The last thing we need to do is to add this new bubble to the chat window. We also scroll the window to the bottom so that users would see the new message without the need to scroll.</li></ul><p>Common functions are ready. Let’s create functions needed to establish data channels.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e734920de6220c73759cb69da4f70a19/href">https://medium.com/media/e734920de6220c73759cb69da4f70a19/href</a></iframe><ul><li>The one creating the data channel will be the initiator of the call. We give it a name since we will be using another channel for file sharing.</li><li>We track the openness of the data channel. When it is open, we execute openTextChannel function to prepare a chat window.</li><li>Lastly, it waits for messages. When a message comes through textChannel , we create a bubble from it.</li></ul><p>Let’s take a look at what the answerer of the call will do to complete text messaging.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/081cb4a7262f64a57d742e8c31a20d31/href">https://medium.com/media/081cb4a7262f64a57d742e8c31a20d31/href</a></iframe><ul><li>The answerer doesn’t create a data channel. If they do so, there will be two data channels and the communication cannot be established.</li><li>So it listens for any data channel to be created. If created data channel has the label of textChannel , it sets the message window like the initiator of the call.</li><li>Likewise, it takes messages coming from the data channel and shows them in the chat window.</li></ul><p>All is set to establish text messaging. However, these are just functions, we don’t execute them. Let’s execute them in their respective places in main.ts .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cacbc09bc2522338093160894d7b8a99/href">https://medium.com/media/cacbc09bc2522338093160894d7b8a99/href</a></iframe><p>We create data channels before making the offer and answer because ICE candidates and SDP objects are created according to the data we will be transferring. That is why we put video and audio streams to peerConnection before even establishing it.</p><p>Let’s take a look at the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LX8Y_iVn5M6qZYx29tdLRQ.png" /></figure><p>As you can see, we not only established a video chat but we also established text communication. You can check out the progress so far from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/12-data-channel">GitHub - OrionInnovationTRTech/magny at 12-data-channel</a></p><p>Do note that this is real-time P2P communication. We don’t store any value on the server. Refreshing the page will reset messages. One can argue that these messages could be kept on users’ computers but there is no guarantee that a user won’t change the content of the messages. For now, think of this app as one time messaging application in which data resets when we exit the application.</p><p>Speaking of reset, we need to add more functionality to our hang-up button since we added a new feature.</p><h3>Reset the Connection</h3><p>In the previous article, we added functionality to close the connection. However, the app doesn’t allow us to reconnect to a new peer. We need to refresh the page and this is not a good way to provide a user experience. So we will be reconfiguring the hang-up function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c824aaa86a69c73170ba33dcf7fb91b2/href">https://medium.com/media/c824aaa86a69c73170ba33dcf7fb91b2/href</a></iframe><p>Add this function to the end of connect.ts file. To reset the connection, it simply closes the connection and creates a new one. The reason why we created a new function in a separate file is that we cannot assign a value to an imported variable. Do note that we changed peerConnection to be a let variable instead of const since we assign a new RTCPeerConnection . You may notice that there is a function named trackConnection . Let’s explore that now.</p><p>Since we need to reopen peerConnection , we need to listen for connection events again. Let’s wrap it under a function like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a904e6f9c80a1328be98444c7874a7d/href">https://medium.com/media/7a904e6f9c80a1328be98444c7874a7d/href</a></iframe><p>We added this function to resetConnection function. In addition, add it right after we declare peerConnection at the beginning of connect.ts file.</p><p>One thing left to do is reset everything. Let’s reconfigure our hang-up function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c52750ea0e784c4a699e8ac7cb8d28f6/href">https://medium.com/media/c52750ea0e784c4a699e8ac7cb8d28f6/href</a></iframe><p>Firstly, we execute the resetConnection function to re-declare peerConnection . After that, we reset and clear the following parts:</p><ul><li>Chat input and send button</li><li>Chat itself</li><li>Offer input</li><li>Call and Answer buttons</li><li>Camera button</li><li>Video elements</li><li>Hang-up button</li></ul><p>By resetting them, we are turning the app to its initial state as if we refreshed the page. You can reach what we have done so far from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/18-reset-the-connection">GitHub - OrionInnovationTRTech/magny at 18-reset-the-connection</a></p><p>That is it for text chatting. You can further improve it by adding timestamps or giving it the functionality to download chat history.</p><p>In the next article, we will be adding the file-sharing feature. Stay tuned for more!</p><blockquote>Until next time…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=385ed0fa5184" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orion-innovation-techclub/webrtc-demystified-text-chatting-385ed0fa5184">WebRTC Demystified — Text Chatting</a> was originally published in <a href="https://medium.com/orion-innovation-techclub">Orion Innovation techClub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebRTC Demystified — Signaling with Firebase]]></title>
            <link>https://medium.com/orion-innovation-techclub/webrtc-demystified-signaling-with-firebase-94e08cc9c899?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/94e08cc9c899</guid>
            <category><![CDATA[telecommunication]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[techclub-tr]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Fri, 07 Oct 2022 06:53:38 GMT</pubDate>
            <atom:updated>2022-10-07T06:53:38.402Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC Demystified — Signaling with Firebase</h3><h4>A convenient way to signal users to each other</h4><p>In the previous article, we have done the following:</p><ul><li>Project Setup</li><li>Base UI for Video Chat</li><li>Firebase App Setup</li></ul><p>In this article, we will establish communication with the help of Firebase. At the end of this article, we will have an application allowing us to see the remote peer’s video and sound.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8psZ5f5S-DW-v4uiL7h0A.jpeg" /></figure><h3>Import Firebase</h3><p>Now that we have everything ready for Firestore, we can finally import it to our project. To do this, we should install the node package of Firebase.</p><pre>npm install firebase</pre><p>After installing it, let’s import the Firestore with credentials that we saw in “Project Settings”.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/260f6f310e03d3efe4d29ebfeaddabfb/href">https://medium.com/media/260f6f310e03d3efe4d29ebfeaddabfb/href</a></iframe><p>Firebase should be imported to get our Firestore database. Also, we imported a bunch of methods from firebase/firestore . We won’t use all of them now but they will be required sooner or later.</p><p>As we have discussed in the Signaling Demo, the call&#39;s initiator must create an offer and send it to the remote peer. The remote peer will create an answer from it and send it back to the initiator.</p><h3>Create an Offer</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/20979b1b95c42eb8ba2d7f34c0a645b2/href">https://medium.com/media/20979b1b95c42eb8ba2d7f34c0a645b2/href</a></iframe><p>That is the function of creating an offer. Don’t be intimidated by the length. We will go over each of them.</p><ul><li>We are referencing the “calls” object to save data and track changes. Every time we make a call, we will create a new call object with a unique ID. These IDs are determined by the Firestore algorithm and they work similarly to UUID algorithms. We will put this unique ID to input which is just below the buttons.</li><li>In addition to the “calls” object, we make references to the “offerCandidates” and the “answerCandidates” collections.</li><li>To add ICE candidates to Firestore, we should listen to onicecandidate event of peerConnection . Every time a new ICE candidate is available, we will upload them to the “offerCandidates” collection in JSON format.</li><li>To initiate the call, we should create an offer description. We set this description as localDescription of peerConnection . From this offer, we shall create an offerSDP object and upload it directly to our “call” object.</li><li>Now that we have, uploaded both offerSDP and our ICE candidates, we will be tracking incoming data from the peer data.</li><li>We are tracking our “call” object and checking if there is a answerSDP ready. If answerSDP is ready and we didn’t set remoteDescription of peerConnection , we set answerSDP as remoteDescription in the form of RTCSessionDescription .</li><li>In addition, we also track “answerCandidates” collection. If there is a change in this collection, we check if this candidate is a new one by the “added” type. Then we add this candidate to our peerConnection .</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4fde24beb17f98f2aa0309008f996a17/href">https://medium.com/media/4fde24beb17f98f2aa0309008f996a17/href</a></iframe><p>Go ahead and bind this function to the button with ID callButton in main.ts file like shown in the code block above. If we are to test the app by turning on the camera and making a call, the result will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1KhjcvxqeWas3t-kCt8I1w.png" /></figure><p>After clicking on the “Make a Call” button, the app will show us an ID. This is the ID of the call that we have made. Let’s check it from the Firestore database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2cpx9lcmohe0Ts2gDZlvw.png" /></figure><p>We can check this call from the Firestore page of our project in Firebase. As we can see we sent our offerSDP object successfully and created the “offerCandidates” collection. This collection consists of more documents which consist of candidates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*vO30REpvcPh0qF8h_VdCXA.png" /></figure><p>We have written a lot of code so it would be good to check your progress from the branch below. We will continue with making an answer to initiated call.</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/3-firebase-import-and-connection">GitHub - OrionInnovationTRTech/magny at 3-firebase-import-and-connection</a></p><h3>Answer the call</h3><p>Now that a peer has initiated a call, the remote peer’s task is to get the required credentials from the server and create an answer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c029cbbef903b09975d1c07075ee045/href">https://medium.com/media/7c029cbbef903b09975d1c07075ee045/href</a></iframe><ul><li>Instead of getting the whole document, we are just getting a specific call from Firestore by callID . Like we did in the other peer, we are creating references to “answerCandidates” and “offerCandidates”.</li><li>To create an answer, we need to have offerDescription ready at our disposal. For this purpose, we are getting SDP data from the incoming call.</li><li>This incoming call just consists of a offerSDP . We set it as our remoteDescription .</li><li>By setting the offerSDP as peer connection’s remoteDescription , we can now create an answer and set it as localDescription .</li><li>Let’s format our answer as SDP as we did for offerSDP and upload it to the Firestore database.</li><li>All left to do is listen to ICE candidates. It is the same as offer creation but we are listening for the “offerCandidates” collection for this peer.</li></ul><p>To execute this function, add an event listener to answerCall button.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9347ce0593a7483dd97b1ad8f60f779/href">https://medium.com/media/f9347ce0593a7483dd97b1ad8f60f779/href</a></iframe><p>To answer the call we need a callID . The user will get this callID from the other peer. After getting it, the remote peer will enter it to offerInput and press the answerCall button. The connection should be successful and the result will look like this from the point of User B:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t8poiPXhn4XnPb8wqzKHDw.png" /></figure><p>Congratulations! You have established a WebRTC connection and you are sending and receiving camera streams. As soon as we open the camera, we already add camera and microphone streams to the connection. All left to do is give the callID to the remote peer. By looking up to the Firestore, peers will get required ICE candidates and SDP objects. Knowing the IP addresses of both peers, WebRTC will establish a connection between them and they can communicate directly. Let’s see what is happening in the Firestore database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AB7aiQT0VsrfxFmryepfKQ.png" /></figure><p>As you can see, both candidates and SDP objects are uploaded. Since peers listen to candidates continuously, there is no need to refresh the connection by giving new candidates manually. The only thing users need to do is exchanging callID between them.</p><p>Let’s see what is happening behind the scenes. We will examine these from the point of User A. Open up your Chrome or any Chromium browser and enter this URL:</p><blockquote>chrome://webrtc-internals/</blockquote><p>Here you can see every application that is using WebRTC in your browser. If the project is running in your browser, you will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*i9BFXdimFsr4sfuDoC5R0A.png" /></figure><p>Our application is <em>http:localhost:5173 . </em>When we first open the app, we just create the connection. Just creating the connection will give us these states:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*xA6LHzPWZwljMh1lkJbYCg.png" /></figure><p>Right now, most of the states are new since we didn’t do anything to RTCPeerConnection apart from creating it. Ignore data channels for now, we will be meddling with them when we create text chat and file sharing.</p><p>Go ahead and start the webcam. You will notice more logs popping up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*MLLkxqimf3nRhZjZQ-kFHg.png" /></figure><p>Here, we can see the tracks we are sending to RTCPeerConnection . These tracks include both video and audio. Once we established the connection, we will see incoming tracks too. Let’s see what is happening when we initiate the call:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*XO6hNI0-VkfIJIn8HBwyog.png" /></figure><p>If we look at events, we will see a lot of events firing up. Most of them are fired up by ICE candidates. Once the app gathers every ICE candidate it can gather from STUN servers, it will stop and change icegatheringstatechange to complete . Open up a new tab for the app and answer the call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*DltCIDrspk0TlypNlPFxZg.png" /></figure><p>If the connection is successful, connectionstatechange will change to be connected . We will use this state to add features like hanging up and erasing data from Firestore. You can also see that signalingstatechange has become stable now. This page is very crucial when you need to debug an application using WebRTC since it shows every state for an RTCPeerConnection .</p><p>You can access the working project from the branch below.</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/8-create-answer">GitHub - OrionInnovationTRTech/magny at 8-create-answer</a></p><h3>Hang up the Call</h3><p>Now that we have established the connection and created a video communication, let’s add the feature to close the connection. To achieve this, add a hang-up button.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fb55fb9e1786da040f9ac2d917f7436/href">https://medium.com/media/6fb55fb9e1786da040f9ac2d917f7436/href</a></iframe><p>We added this button after the offerInput where we provided the callID value. It is disabled in the beginning. Once the call is established, we can turn on the hang-up button. To detect this, we will use connectionstatechange what we have seen in the WebRTC console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*cl90eqlyJn7XrMZ-hZkxfg.png" /></figure><p>When the call is established, connectionstatechange becomes connected . At this point, we can make enable the hang-up button.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da93e59e218437c63f60547bd8d5afec/href">https://medium.com/media/da93e59e218437c63f60547bd8d5afec/href</a></iframe><p>If we add this snippet of code right after we create RTCPeerConnection , the event listener for connected state will enable the hang-up button. Right now the button doesn’t do anything. Let’s add the functionality:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59e0e4651cda6b6abe2fc5ce4a2cca37/href">https://medium.com/media/59e0e4651cda6b6abe2fc5ce4a2cca37/href</a></iframe><p>If we add this code to the end of main.ts file, the connection will be closed and the remote camera will be closed. We also disable the hang-up button again for further connections. However, the remote peer will get a frozen camera since it doesn’t do anything if the other user disconnects. In addition, User B might close the application and User A will still get a frozen camera. We need to add an event listener for this.</p><p>Let’s see what happens when user B closes the app behind the scenes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*zlDWtZpzd_7IFU17xD1-3Q.png" /></figure><p>As you can see when the remote peer closes the app, connectionstatechange first becomes disconnected . In this state, it tries to reconnect for a couple of seconds. However, the app could not connect and it fails to connect again. We will be checking for disconnected state to prevent the frozen camera.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a012c3ec5812ef23ceb53d5b259aa9c9/href">https://medium.com/media/a012c3ec5812ef23ceb53d5b259aa9c9/href</a></iframe><p>In addition to our connected event, we check for disconnected event. Since we created a function for hang-up button, we can use the same function by importing it. You check the progress so far from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/10-hang-up-feature">GitHub - OrionInnovationTRTech/magny at 10-hang-up-feature</a></p><p>And that is it for video chatting and signaling with Firebase. In the next articles, we will implement text chat and file sharing features. Stay tuned for more!</p><blockquote><em>Until next time…</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94e08cc9c899" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orion-innovation-techclub/webrtc-demystified-signaling-with-firebase-94e08cc9c899">WebRTC Demystified — Signaling with Firebase</a> was originally published in <a href="https://medium.com/orion-innovation-techclub">Orion Innovation techClub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebRTC Demystified — Project Setup]]></title>
            <link>https://medium.com/orion-innovation-techclub/webrtc-demystified-project-setup-28494c4f6a05?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/28494c4f6a05</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[techclub-tr]]></category>
            <category><![CDATA[telecommunication]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Mon, 26 Sep 2022 12:40:00 GMT</pubDate>
            <atom:updated>2022-09-26T12:40:00.588Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC Demystified — Project Setup</h3><h4>Let’s create a video chat and file sharing application</h4><p>Establishing real-time communication is a bit tricky. As mentioned in the previous article, there is no standard signaling method to connect peers. We can use WebSockets or an intermediary app like WhatsApp or Discord. The choice is up to us. Besides, pure signaling is not enough. There are many things to take into consideration to establish a WebRTC connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7Q9K4egg2upj25BRbcvbQ.jpeg" /></figure><p>Starting from this article, we shall be building an app called Magny. Magny is a demo project designed to show what WebRTC can do. It has three main functionalities:</p><ul><li>Video call</li><li>Text chat</li><li>File Transfer</li></ul><p>Magny is a web project, so we will use Node.JS to develop it. Its framework will be Vite, a build tool designed for modern web projects. Instead of Javascript, TypeScript will be used since it has many modern functionalities and it can provide a modular project that is easier to examine. Without further ado, let’s set up our development environment.</p><h3>Setup</h3><p>Before we start, make sure that you have Node.JS installed in your system. If it is not installed, you can install it from here. If you are a beginner, it would be ideal to install the LTS version.</p><p><a href="https://nodejs.org/en/">Node.js - Run JavaScript Everywhere</a></p><p>With Node.JS ready, let’s create our project. Open up your terminal and navigate to the folder where you want to create your project.</p><pre>npm create vite@latest</pre><p>This command will ask you the project name. We named it magny . Then, it will prompt you to select a framework and variant. Let’s select vanilla framework and vanilla-ts variant. With that completed, our project is created. Navigate to the project folder and install the required node packages by:</p><pre>cd magny<br>npm install</pre><p>Before running the project, let’s open the project in a code editor. We will be using Visual Studio Code. Since we may need to run our project on different devices, change package.json like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/263b05adabf4a3d1e03edfdefef05044/href">https://medium.com/media/263b05adabf4a3d1e03edfdefef05044/href</a></iframe><p>By adding --host flag to dev script, we can access the project from our phone if the computer and phone are connected to the same network. To see our project:</p><pre>npm run dev</pre><p>You will see your project running up and the terminal will give you two URLs to see your project. You can either go to localhost or your device’s local network IP. However, the browser will not allow you to access the camera device if you test the application in the local network IP. This is because the local network does not provide an SSL-supplied connection and the browser will not allow device access in insecure connections. We will be testing the app cross-device when we deploy it to Netlify.</p><p>If you look at the project, you will see a template provided by Vite. Since we need a clean slate, delete counter.ts and typescript.svg . To put icons on buttons, we need Font Awesome Kit. Register to Font Awesome and they will e-mail you your kit. You just need to put the kit just before the body closing tag.</p><p>Since we will be focusing on WebRTC, I have prepared the UI beforehand. You can clone it from the Github branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/1-first-ui">GitHub - OrionInnovationTRTech/magny at 1-first-ui</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhPxhEIwaCPWqQSc4F50kw.jpeg" /></figure><p>As you can see from the figure above, we aim to establish a video chat with the remote peer. The process will be very simple. We shall first start our webcam and this will also create a RTCPeerConnection . By making a call, the app will create SDP and ICE candidates and upload them to the Firestore database. We only need to deliver the call ID to the remote peer. The remote peer will paste the call ID and answer the call. Let’s continue with creating a local connection.</p><h3>Create a Peer Connection and Streams</h3><p>Firstly, we need to create a peer connection and create some info to connect to the remote peer. Go ahead and create a file called connect.ts . You will notice that the file gives an error as soon as it is created. This is because this Vite variant has a system in which just the file main.ts compiles. Other TypesScript files are sort of class files and they need to export simple variables or functions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f743b1cf44df1e2622f51ac8da44269b/href">https://medium.com/media/f743b1cf44df1e2622f51ac8da44269b/href</a></iframe><p>Before establishing a connection, we need to initialize a new RTCPerConnection which is supplied by a couple of STUN servers. There are many STUN servers for us to use but we will continue with servers provided by Google. iceCandidatePoolSize allows us to create ICE candidates even before creating an offer. How many ICE candidate we will get is up to the content of the connection. For this case, we will be adding camera tracks to our connection and will get a couple of ICE candidates beforehand. Speaking of cameras, let’s add both our video and remote peer’s video.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8155b7f64dfadbf0cc2c19b4dd964f06/href">https://medium.com/media/8155b7f64dfadbf0cc2c19b4dd964f06/href</a></iframe><p>The first function will start to get video from our webcam. We are enabling both video and audio. After getting the stream from our webcam, we can iterate over it by getTracks() method. getTracks() method will give us a couple of tracks coming from the stream of the webcam. We will be iterating it and adding each of them to our peerConnection so that streams would be sent to the remote peer.</p><blockquote>Since we will be testing the app in our local device, it would be a good idea to turn audio to false , otherwise it will cause an echo.</blockquote><p>The second function gets the stream of the remote peer. We are listening for tracks coming from the peerConnection . We add each track to remoteStream which will reflect the video and audio to remoteVideo . Now the app should look like this when we click on the “Start Webcam” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUvU5-oLGiDp8iVqmZJIAw.png" /></figure><p>We made the first step for establishing a connection, opening a track between peers. To bind these tracks, we need to signal the remote peer. In our previous article, we signaled the remote peer by copying and pasting. However, this solution would be far from ideal since we need the user to open up the console. Instead of getting the entire SDP, we will store these SDP objects and ICE candidates in a database. The remote peer will fetch credentials from the database. The only thing we need to send is the ID of the call which consist of offer and answer candidates. To achieve this, we will be using the Firestore database of Firebase.</p><h3>Create and Import a Firebase Project</h3><p>Firebase is a great tool to develop mobile and web applications. It is used by millions of developers and it is backed by Google. For our use case, we will use it as a database for signaling. Go ahead and log in to Firebase with your Google account.</p><p><a href="https://firebase.google.com/">Firebase | Google&#39;s Mobile and Web App Development Platform</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*hSq-0gwR_uNpjBtK6zqlsg.png" /></figure><p>After you logged in, enter the console by clicking on the indicated button. It should be in the right-top corner. In the console, you will see your projects (if any) and some options like demo projects. We will be creating a new project from scratch. Click on “Add Project”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*YBQyZvdPe3zHFpt6kQKzfQ.png" /></figure><p>For the first step, let’s name our project “magny”. You can name it whatever you want it to be. There is no limitation such as “this name is taken” because Firebase will assign an ID for every project so that every one of them will be unique even if they have the same name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*UTqtIbeDT7vjx2ByQHE55w.png" /></figure><p>The second step will ask you if you want to enable Google Analytics for this project. It would be a good idea to enable it if you want to improve this project further. Do note that Google Analytics is out of the scope of this tutorial. If you enable it, Firebase will ask you to select an account for Analytics. Choosing the default account is enough for now. After completing this step, wait for the project creation, it should take a few seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*oa_mCCJ68yJABRqMoxX3jQ.png" /></figure><p>After creating the project, we need to add an app to use the database. For this case, we will be selecting a Web project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*Wlj2FfiWihS86x0mZUyUkg.png" /></figure><p>Go ahead and register your app with a nickname. We named it again with “magny”. There is no need for Firebase hosting for now but it can be used to deploy our app when we completed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*a7oOfEu4wq-YW99KMjNdhA.png" /></figure><p>After waiting for a couple of seconds for the app to register, you will see some credentials for your app. firebaseConfig will be very crucial since our app will access the database by using these credentials. If you want to see these credentials again, go to the console main page and click on “Project Settings”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*Z-t3XO6Uq1vRAwfEqUzYyQ.png" /></figure><p>Here, you will your apps if you scroll down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3KTPHO4UMQWWq3akQeoTg.png" /></figure><p>We will be using npm to get the required SDK. Before doing so, we need to create a Firestore database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3B31Xqzj-g9GFejpoC3fgQ.png" /></figure><p>Go to the console main page. You can create Firestore either from the left bar or from the box in the middle of the page. Click on either of them and click on the “Create Database” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6IuAXPZzp7K7_sbPxAhwdg.png" /></figure><p>Since we will be testing the application many times in the development process, create the database in <strong>test mode. </strong>Test mode will allow all read/write requests as long as credentials are true.</p><blockquote>Test mode will only allow requests that are made within 30 days. After 30 days, you need to change security rules to access your data.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*sm1M76uJWxetu5lwFbd_VA.png" /></figure><p>Lastly, select the location of the cloud. There are many options. Select the one closest to you. Selecting a Multi-region location would be ideal since they have the broadest support in Firebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t13mWeUAFT9jKuTGZ_ioCw.png" /></figure><p>The result will look like this. We are done with the Firebase console. We will be adding collections directly from our app. Let’s get back to our app.</p><p>For a more modular structure, copy camera functions to a new file called camera.ts . To use peerConnection , export it and import it in camera.ts . You can check the state of the app from the branch below:</p><p><a href="https://github.com/OrionInnovationTRTech/magny/tree/5-camera-setup">GitHub - OrionInnovationTRTech/magny at 5-camera-setup</a></p><p>So far, we set up the base UI for our app. We are also showing the camera to the user. In the next article, we will focus on how we can achieve signaling with the Firestore database.</p><blockquote>Until next time…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28494c4f6a05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orion-innovation-techclub/webrtc-demystified-project-setup-28494c4f6a05">WebRTC Demystified — Project Setup</a> was originally published in <a href="https://medium.com/orion-innovation-techclub">Orion Innovation techClub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebRTC Demystified — Signaling Demo]]></title>
            <link>https://medium.com/orion-innovation-techclub/webrtc-signaling-demo-36722cdd9d97?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/36722cdd9d97</guid>
            <category><![CDATA[telecommunication]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[techclub-tr]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Fri, 09 Sep 2022 06:34:48 GMT</pubDate>
            <atom:updated>2022-09-09T06:34:48.342Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC Demystified — Signaling Demo</h3><h4>Let’s examine signaling in practice</h4><p>WebRTC is one of the popular concepts in RTC technologies and there are various tutorials. Besides, there are plenty of libraries (especially for NPM) that use WebRTC to establish communication for many uses. Many of the tutorials use these libraries to show how to build clone applications of Zoom, Discord, etc. However, they fail to show how WebRTC works at its core.</p><figure><img alt="A soldier signaling with a flare in a sunset background" src="https://cdn-images-1.medium.com/max/1024/1*0ZeX_yHLFxqHaoTXzU_CKg.jpeg" /></figure><p>In this article, we will be building a simple demo that demonstrates signaling between two browsers. It will only require a browser and some Javascript code. Since the goal is to grasp the signaling concept, it will not be a useful application but rather a demo that demonstrates each of the components that are required to establish a connection in a simple way.</p><h3>Setup</h3><p>For this demo, we need two browsers working at the same time. One will be User A while the other one will be User B. File structure is shown in the diagram below. If you wish, you can use two computers to see the connection between different devices. It will be the same case whether you use the same device or two devices.</p><pre>signaling demo<br>├── userA<br>│   ├── index.html<br>│   └── scriptA.js<br>└── userB<br>    ├── index.html<br>    └── scriptB.js</pre><p>HTML files will be blank, they just need an HTML boilerplate and they need to be connected to their script files.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4cdf29efb777df95f15fc556fadb5307/href">https://medium.com/media/4cdf29efb777df95f15fc556fadb5307/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef2a969e98f9fad39e39746392d3dc0f/href">https://medium.com/media/ef2a969e98f9fad39e39746392d3dc0f/href</a></iframe><p>To work with our environment, I would recommend opening the signaling demo folder in VS Code and enabling Live Share. Then we can open up two tabs to access two of the directories:</p><pre>http://127.0.0.1:5500/userA<br>http://127.0.0.1:5500/userB</pre><p>Yet, it will suffice to just open HTML files on a browser. We don’t need the page itself, we just need to open two tabs and their consoles like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WlPZV1PzjmzkXpgpZjm9kA.png" /></figure><h3>Create SDP</h3><p>Setup is ready, let’s start with scriptA.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f0d81cfe38fc00eb43ce0e1bff3cf2c/href">https://medium.com/media/4f0d81cfe38fc00eb43ce0e1bff3cf2c/href</a></iframe><ul><li>The first step is to create a RTCPeerConnection establish our connection.</li><li>This connection will require a data channel to carry our messages. We create it for alocalConnection and set its label to dataChannel.</li><li>We need some event listeners to get updates from the connection:</li><li>The first one listens to if the data channel has been opened or not. Openness means that the connection with the remote peer is successful and data channels between peers are linked.</li><li>Once the data channel is open we can begin to listen to incoming messages.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6b741198afdcfd43dd891edc0ab03f5/href">https://medium.com/media/c6b741198afdcfd43dd891edc0ab03f5/href</a></iframe><ul><li>To get our SDP object, we need to create an offer. This offer will be saved to the local description of User A.</li><li>Now we listen for ICE candidates. Once the offer is created we will get several ICE candidates for our device. Each time we got a new ICE candidate we update our SDP so that it contains all of the candidates so far.</li></ul><p>SDP is created and we can see it in the console. We will have a couple of SDP objects but we need the last one since it contains all of the ICE candidates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*64idtIsI4RhxDwe2ILEN4A.png" /></figure><p>We can easily copy it as shown in the image above. To accomplish the signaling we need to transfer this SDP object to the remote peer. For this demo, we just copy it and will use it in User B. In the next article, we will examine how we can signal SDP via the Firebase database.</p><h3>Signal the Offer and Create an Answer</h3><p>Before continuing with User A, we need to pass SDP to User B. Let’s start to code scriptB.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e4502eac8489230d82543d676a41957/href">https://medium.com/media/1e4502eac8489230d82543d676a41957/href</a></iframe><ul><li>Like we did for User A, we create an RTCPeerConnection object and listen for new ICE candidates. These candidates will show up when we create an answer for User B.</li><li>Event listeners are similar but there is a small difference. Since User A has initiated the signaling process, its data channel will be passed to User B when the connection is established which means that they will share the same data channel. Because of that, we need to listen to the data channel for User B. When there is an event happening in the data channel, User B will be listening for open and message events like User A.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65a5a3f320c5c9c5b9f8214824534c97/href">https://medium.com/media/65a5a3f320c5c9c5b9f8214824534c97/href</a></iframe><ul><li>We are using a function here because we will call this function once we get an SDP offer from User A.</li><li>To pass the SDP to User B, we set the offer as a remote description.</li><li>When we set the remote description, we can create our answer and set it as the local description.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c5bba15dd83efcec3e294aa24acb2a0/href">https://medium.com/media/7c5bba15dd83efcec3e294aa24acb2a0/href</a></iframe><p>Once we execute the function, an answer will be created and User B’s SDP will be updated each time a new ICE candidate is found. Like we did previously, we will copy the answer SDP object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*BnvlVPsNYZ_eo0dfDckHEQ.png" /></figure><h3>Establishing the Connection and Sending Messages</h3><p>We get back to User A and finish scriptA.js. We will be defining two more functions to gain chatting functionality.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29b8afcf2a5932b1158570734f4ef43d/href">https://medium.com/media/29b8afcf2a5932b1158570734f4ef43d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/476b53c744cab6db4e9526490fd4e6c5/href">https://medium.com/media/476b53c744cab6db4e9526490fd4e6c5/href</a></iframe><ul><li>To finish the signaling process, we need to signal User A back. We set the answer SDP as the remote description of User A.</li><li>Once we finish the signaling, the data channel will be opened for both sides. We can easily send a message from User A to User B via the data channel.</li></ul><p>There is one last function left and we will declare it in scriptB.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95d31ac761e4fc91902316908d721c80/href">https://medium.com/media/95d31ac761e4fc91902316908d721c80/href</a></iframe><p>This function is a bit different because User B uses the data channel it got from User A. So it needs to use the data channel bound to its connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*eV650L_EnshkNALiq3Dgug.png" /></figure><p>By establishing the connection, we can easily send simple variables like strings to a remote peer. It is not limited to that, you can send video-audio tracks, objects, and even files. In the next article, we will begin to build our application which can do all of them.</p><p>If you want to try out the demo, you can find it in the GitHub repository.</p><p><a href="https://github.com/OrionInnovationTRTech/webRTCSignallingDemo">GitHub - OrionInnovationTRTech/webRTCSignallingDemo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36722cdd9d97" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orion-innovation-techclub/webrtc-signaling-demo-36722cdd9d97">WebRTC Demystified — Signaling Demo</a> was originally published in <a href="https://medium.com/orion-innovation-techclub">Orion Innovation techClub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebRTC Demystified — Introduction]]></title>
            <link>https://medium.com/orion-innovation-techclub/webrtc-demystified-introduction-dcd826368e8?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcd826368e8</guid>
            <category><![CDATA[techclub-tr]]></category>
            <category><![CDATA[real-time-communication]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[p2p]]></category>
            <category><![CDATA[webrtc]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Mon, 22 Aug 2022 08:01:27 GMT</pubDate>
            <atom:updated>2022-09-09T06:35:42.713Z</atom:updated>
            <content:encoded><![CDATA[<h3>WebRTC Demystified — Introduction</h3><h4>A modern way of real-time communications</h4><p>With so many exploits happening in big tech companies, many of us are delicate about our privacy. We want our data and credentials to stay safe. The most secure way to achieve this is not using apps at all but we all know that it isn’t possible. A more reasonable way is to use apps that are not using servers to store our data. However, most projects use servers to store our data and we are increasingly becoming obliged to use them in our everyday lives.</p><figure><img alt="Real Time Communication Diagram — Computer Connected Directly" src="https://cdn-images-1.medium.com/max/1024/1*9I9gtayRtMv06jbTiMr4Uw.png" /><figcaption>Courtesy of <a href="https://pixabay.com/users/sandra_schoen-53876/">Pixabay</a></figcaption></figure><p>Thankfully, there is an alternative; peer-to-peer (P2P) communication. P2P communication is mostly used by Torrent and blockchain technology. This communication connects users and they can send data to each other directly without an intermediate server. P2P ensures that data is not observed by a third party and is only transferred between corresponding parties.</p><p>One of the P2P technologies is WebRTC, Web Real-Time Communication. It is a standardized API that allows users to exchange any kind of data efficiently with low latency. The API is specified for Javascript but it can be used by other languages with the help of other APIs and tools. WebRTC allows us to build cross-platform applications that are connected directly.</p><figure><img alt="A cat with a headphones" src="https://cdn-images-1.medium.com/max/1024/1*vu45r2g3vmscNpcu7agiuw.jpeg" /></figure><p>WebRTC is not the first to implement real-time communication but it is better than others in terms of interoperability, efficiency and standardization. Other than connecting users, it is very simple to use since it manages data transfer automatically. The actual part is establishing the communication.</p><p>Establishing a P2P communication is similar to Client-Server communication. Users must share their public IP addresses to establish a communication. However, just IP addresses are not enough. With NAT subnets covering all of the Internet, direct communication is not easy as it used to be. To solve this, WebRTC implemented new ways to traverse NATs so that users can connect directly. Let’s start with NAT subnets and the problem they are creating.</p><h3>Network Address Translation (NAT)</h3><p>Network Address Translation is a crucial part of the Internet we use today. It is used to create local networks that are controlled by a router or an ISP. Our IP addresses are mostly determined by the network we are connected to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KoBXVwOr6qSzePxyYWjSFA.jpeg" /></figure><p>As shown in the figure, three out of four parts of the IP address is identifying the network. Only the last part is used to identify the host. Why? Because it is much easier and more efficient to divide the Internet into subnets rather than thinking of every host as a node of its own.</p><p>Every host is a part of the subnet that is controlled by a router which is part of bigger networks such as ISP networks. The original idea to create NAT was to avoid the need of renaming every host when a network was moved. Because an external IP can be shared by many hosts and just renaming that inclusive IP address will be enough to move all of the hosts in the network.</p><p>Think of a computer, a mobile device and a TV at a home. All of them are connected to a router with WiFi. For those outside of the network, the IP address of the three devices will be the same. Yet, every one of them has its local IP addresses to distinguish them.</p><blockquote><em>External IP: 52.243.152.12 <br>Computer’s Local IP: 192.168.1.4 <br>Mobile Device’s Local IP: 192.168.1.8 <br>TV’s Local IP: 192.168.1.</em></blockquote><p>This also helps the limited pool of IPv4. There are a total of 2³² IPv4 addresses in total. With so many users using multiple devices, it is depleting fast and we have run out of them. There is no available IPv4 address to allocate to new users. By making devices share one IPv4 address, this problem was solved for a time.</p><p>On the other hand, NAT made things harder for P2P connections. Since a device’s IP address is not its IP address, we cannot connect users by simply sharing IP addresses. For connection, WebRTC has another addressing method called ICE server which is simply available external IP and local IP mappings that users from outside can connect to. Yet, we need STUN or TURN servers to determine these ICE servers.</p><h3>STUN</h3><p>Session Traversal Utilities for NAT is a standard method of NAT traversals. Many of us must have typed “What is my IP address?” to Google. This question is answered with the help of STUN servers. It does a pretty simple job. The host sends a request and the STUN server responds to the host by just saying who has contacted him. Let’s see this in the process.</p><ul><li>A computer with local IP and port of 192.168.1.4:3333 has made a request to a STUN server with a domain and port of stun.l.google.com:19302</li><li>This request goes through the NAT and the router renames the sending IP:port with 52.243.152.12:3333</li><li>STUN server just looks at the who sent the request and says that “You are 52.243.152.12:3333” in the response packet. Then it sends it to</li><li>Receiving the response, the router forwards the packet to the computer.</li><li>By getting the response, the computer sees that its public IP address is 52.243.152.12:3333.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXhy4-v5yXyPPQUJf_liqA.jpeg" /></figure><p>Since it does a pretty simple job, it is cheap to maintain a STUN server and many STUN servers are free to use.</p><p>Nevertheless, some NAT translation methods do not work with STUN servers. These translation methods look at NAT’s dictionary and search for some matches. While one looks for if that IP address has communicated before, one looks for if that IP:port has communicated before. On the other hand, Symmetric NAT looks for an exact match between caller and receiver. Let’s think of a NAT dictionary.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/613b16b114594947056bdd80a1c7f07f/href">https://medium.com/media/613b16b114594947056bdd80a1c7f07f/href</a></iframe><p>Now, let’s think of some connection attempts.</p><ol><li>4.4.4.2:80 → 52.243.152.12:4444</li><li>2.2.2.3:8080 → 52.243.152.12:4444</li></ol><p>If the translation method is Address Restricted or Port Restricted, both of the connections will be allowed because those IP:port addresses have been communicated before. However, Symmetric NAT will not allow for communication 1 to happen because such a call has never happened before. There needs to be a previous connection that exactly matches both IP:port addresses. Communication 2 will be allowed because there is a previous connection that matches the new connection.</p><p>Because of this strict rule, devices with Symmetric NAT will not work with STUN servers. There will not be a problem requesting the STUN server. However, the other user cannot connect to the user. Let’s say that User B with Symmetric NAT has made a STUN request and shared that “I’m 9.8.2.2:3333”. However, when the User tries to connect with 9.8.2.2:3333, User B will not accept since User A has never made a connection to that particular address. That address was created for the STUN server, not another user.</p><p>For Symmetric NAT, we need another technique called TURN.</p><h3>TURN</h3><p>Traversal Using Relays around NAT is another method for NAT traversals. It does a little bit more job than a STUN server. Instead of returning a response, it relays the message to the remote peer. In other words, the connection is established through a server. All media and messages are relayed with the TURN server. It is not peer-to-peer communication but it is needed. Some networks use Symmetric NAT and STUN servers cannot work with them due to their restrictions.</p><p>STUN servers provide us with many candidates and we need to gather them. To do this, we will be using ICE.</p><h3>ICE</h3><p>Interactive Connectivity Establishment collects all available candidates for users to connect with. These candidates could be local IPs, STUN addresses or TURN addresses. We collect local IP addresses because users might be in the same network, so it would be better for them to connect within the local network.</p><p>Getting these candidates is important because WebRTC will try another one if a certain ICE candidate does not work while connected to the remote peer.</p><p>We wrap all of these candidates and send them to remote users in SDP format.</p><h3>SDP and Signaling</h3><p>Session Description Protocol is a format that describes lots of things such as ICE candidates, networking options, media options, security options and so on. Despite its name, it is not a protocol, it is a format.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bfcdcbefe12c3a70f4ee5e8f9570dc8d/href">https://medium.com/media/bfcdcbefe12c3a70f4ee5e8f9570dc8d/href</a></iframe><p>Playing a hugely important role in WebRTC, SDP needs to be sent to the other user. This is where things get a bit cloudy. WebRTC doesn’t specify a certain way to do that. We can send the whole package by hand, via WhatsApp, Discord, Slack, and so on. Alternatively, we can store SDP in a server like Firebase and the other user can request it from the server.</p><p>Signaling is very important and we shall examine it in more detail with a demon in the next article. We will be building a very basic chat script with Javascript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcd826368e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orion-innovation-techclub/webrtc-demystified-introduction-dcd826368e8">WebRTC Demystified — Introduction</a> was originally published in <a href="https://medium.com/orion-innovation-techclub">Orion Innovation techClub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum 2.0 — Proof of Stake]]></title>
            <link>https://medium.com/@furkancanbaytemur/ethereum-2-0-proof-of-stake-421b62e077e1?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/421b62e077e1</guid>
            <category><![CDATA[proof-of-stake]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[medalla]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[deneme]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Sat, 07 Nov 2020 16:21:18 GMT</pubDate>
            <atom:updated>2020-11-07T16:21:18.080Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ethereum 2.0 — Proof of Stake</h3><h4>Ethereum’un Yeni Çağına Doğru</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iMwcCvm4Ol-TzhtPq8AZag.jpeg" /><figcaption>Ethereum 2.0</figcaption></figure><p>Ağını daha da geliştirmek ve sorunlarına çözüm bulmak isteyen Ethereum geliştiricileri, Ethereum 2.0 üzerinde uzun süredir çalışıyordu. Geçtiğimiz günlerde Danny Ryan, EIP-2982 teklifi ile Proof of Stake algoritmasını Ethereum için tanıttı. Yılın sonuna doğru geçilmesi planlanan Ethereum 2.0&#39;ı birkaç başlık ile yeniden hatırlayalım.</p><p><strong><em>Proof of Stake</em></strong></p><p>Ethereum’un 2. versiyonu konsensüs sisteminin, Proof of Work’ten Proof of Stake’e geçmesi ile gerçekleşecek.(Hard Fork) PoW gerektirdiği yoğun işlem gücünden dolayı özellikle büyük blockchain ağlarında yeni kullanıcıların madenci oluğ ağa katkı yapmasına engel oluyordu. Ayrıca çok fazla elektrik masrafına sebep olan PoW yerine PoS daha istikrarlı bir doğrulama ve konsensüs sitemini sağlayabilir. Proof of Stake ile insanlar belirli miktarda tokenı hisse olarak kitlerler ve karşılığında doğrulayıcı olabilirler. Herhangi bir saldırı durumunda tokenlara el konulabilir. Bu da ağın güvenliğini sağlar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dCrNYSPyoLS9Kd9PJj9S4A.jpeg" /><figcaption>Proof of Stake</figcaption></figure><p><strong><em>İşlem Ücretlerinin Yüksek Olması</em></strong></p><p>Son zamanlarda Ethereum ağında tahmin edilenden fazla işlem hacmi olduğundan işlem ücretleri hem yüksek hem de oldukça değişken. Vitalik Buterin, Ethereum 2.0 ile bu sorunun çözüleceğini belirtiyor. Fakat DeFi Uzmanları farklı bir görüşte. Ağı farklı bir konsensüs mekanizmasına geçirmek yerine, ikinci katman çözümlerinin daha etkili olacağı düşünülüyor. İşlemlerin asıl katmanda, işlem ücretlerinin ise ikinci ayrı bir katmanda gerçekleşmesi fikri birçok uzman tarafından destekleniyor.</p><p>Beşinci ve son test ağı olan Medella, birkaç engele takılsa da başarıyla tamamlandı. Test ağının geliştiricisi Prysmatic Labs bu test ağı ile Ethereum 2.0&#39;ın yıl sonuna çıkmaya hazır olacağını belirtti. Beacon Chain olarak da adlandırılan versiyon 2&#39;yi birçok kişi merakla bekliyor.</p><h3>Bizi Takip Edin</h3><p><a href="https://blockchainist.org/">Web Sitemiz</a></p><p><a href="https://twitter.com/BCISTCenter">Twitter</a></p><p><a href="https://www.linkedin.com/company/blockchainist-center/">LinkedIn</a></p><p><a href="https://www.instagram.com/bcistcenter/">Instagram</a></p><p><a href="https://www.youtube.com/channel/UCI-McyMd08P8O5I_aMpa5Vg">YouTube</a></p><p><a href="https://t.me/blockchainistcenter">Telegram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=421b62e077e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sosyal Medya Aracılığıyla Siyasi Katılım ve Blockchain]]></title>
            <link>https://medium.com/@furkancanbaytemur/sosyal-medya-arac%C4%B1l%C4%B1%C4%9F%C4%B1yla-siyasi-kat%C4%B1l%C4%B1m-ve-blockchain-518d74147f2?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/518d74147f2</guid>
            <category><![CDATA[iceland]]></category>
            <category><![CDATA[althing]]></category>
            <category><![CDATA[deneme]]></category>
            <category><![CDATA[social-democracy]]></category>
            <category><![CDATA[democracy]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Sat, 07 Nov 2020 16:21:11 GMT</pubDate>
            <atom:updated>2020-11-07T16:21:11.670Z</atom:updated>
            <content:encoded><![CDATA[<h4>İzlanda’da Modern Demokrasi Örneği</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWx4dGnzSg2zBg066esvyA.png" /><figcaption>Althing — Iceland</figcaption></figure><p>Doğrudan demokrasi Antik Yunan’da ilk örneğini gördüğümüz halkın doğrudan devlet yönetiminde yer almasıdır. Günümüzde yaygın olarak temsili demokrasi örnekleri bulunmaktadır. Antik Yunan’da gördüğümüz sisteme benzer bir örneğe yakın zamanda İzlanda’da rastladık.</p><p>2008 Ekonomik Krizi sonrası arkalarında 25 milyar dolarlık borç bırakarak iflas eden üç büyük İzlanda bankası nedeniyle meclise olan güvenini kaybeden halk 3 aylık bir protesto ile seçimlerin yenilenmesini sağladı. Seçim sonrası 25 komisyon üyesi yeni anayasa taslağını hazırlarken halkın fikirlerini almak için Facebook kullandı ve Twitter üzerinden vatandaşların sorularını cevaplayarak duyurular yaptı. 16,000’e yakın öneri ve yorum sonrası 114 maddelik anayasa taslağı hazırlanarak vatandaşlara aşağıdaki 6 soru soruldu.</p><ol><li>Anayasa taslağının yeni bir anayasanın temelini oluşturmasını onaylıyor musunuz?</li><li>Ülkedeki doğal kaynakların kamuya ait olmasını onaylıyor musunuz?</li></ol><p>3. Ülkede resmi bir kilisenin olmasını onaylıyor musunuz?</p><p>4. Parlamentoda daha fazla sayıda bağımsız aday görmek istiyor musunuz?</p><p>5. Ülkenin her kısmına eşit oranda oy ağırlığının verilmesini onaylıyor musunuz?</p><p>6. Seçmenlerin belirli konular ve yasalar için halk oylamasını istemesini onaylıyor musunuz?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NXDZiO8xbUEirOrnwY6ThA.jpeg" /><figcaption>Halk Demokrasisi</figcaption></figure><p>Temsilcilerin seçimi kaybetmesi nedeniyle kabul edilmeyen anayasa taslağı bize modern bir demokrasinin gerekliliklerini gösterdi. İzlanda eğitim ve internet erişimi açısından avantajlı bir ülke olduğundan sosyal medya ile böyle bir süreci sorunsuz ilerletebildi. Fakat dünya genelinde böyle bir erişim düzeyi ve refah olmadığından internet üzerinden demokrasi için güvenli bir teknoloji gerekiyor. Bu teknoloji ise merkeziyetsiz ve şeffaf yapısı sayesinde blockchain ile başarılabilir. Blockchain bize merkeziyetsiz bir ağ sunduğundan birçok hile ve teknik aksaklıktan sakınmamıza yardımcı olur. İzlanda’daki tecrübeler ve blockchain teknolojisi ile daha ideal bir demokrasiyi elde etmek çok da uzak bir ihtimal değil.</p><h3>Bizi Takip Edin</h3><p><a href="https://blockchainist.org/">Web Sitemiz</a></p><p><a href="https://twitter.com/BCISTCenter">Twitter</a></p><p><a href="https://www.linkedin.com/company/blockchainist-center/">LinkedIn</a></p><p><a href="https://www.instagram.com/bcistcenter/">Instagram</a></p><p><a href="https://www.youtube.com/channel/UCI-McyMd08P8O5I_aMpa5Vg">YouTube</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=518d74147f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain ile Elektronik Oylama: Rusya]]></title>
            <link>https://medium.com/@furkancanbaytemur/blockchain-ile-elektronik-oylama-rusya-38680d09a20b?source=rss-2eb59b22e355------2</link>
            <guid isPermaLink="false">https://medium.com/p/38680d09a20b</guid>
            <category><![CDATA[putin]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[russia]]></category>
            <category><![CDATA[voting]]></category>
            <dc:creator><![CDATA[Furkan Can Baytemur]]></dc:creator>
            <pubDate>Fri, 06 Nov 2020 16:00:42 GMT</pubDate>
            <atom:updated>2020-11-06T16:00:42.817Z</atom:updated>
            <content:encoded><![CDATA[<h4>Yeni normalde yeni oylama sistemi</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QkLsXY80tOnN8z7fCp4nPw.jpeg" /><figcaption>Demokratik Oylama</figcaption></figure><p>Rusya’da %77,9’luk bir oy oranı ile başkanlık seçimlerinin yenilenmesi onaylandı. Covid-19 ile normal oylama işlemlerinin zorlaşacağını fark eden devlet elektronik oylamaya yöneldi. Hem daha güvenli bir oylama süreci gerçekleştirmek hem de katılım oranını arttırmak adına Rusya, blockchain tabanlı bir oylama sistemi üzerine çalışmalarını başlatmıştı. Bu sistemi kurmak içinse birçok blockchain çözümü projeleri ile öne çıkan Bitfury şirketi ile anlaştı. Salgının en çok etkilediği Moskova ve Nijni Novgorod bölgelerinde gerçekleşecek olan sisteme vatandaşlar, kimlik bilgileri ile kolayca üye olup özel anahtarları ile istedikleri cihazdan oy verebilecekler. Oylar güçlü kriptografik algoritmalar ile korunacak ve istatistikler şeffaf bir şekilde gösterilecek.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujGtd7mp6PjUiWPxsSASUQ.png" /><figcaption>Elektronik Oylama</figcaption></figure><p>25–30 Haziran tarihinde gerçekleşen test oylamasında, oylamanın ilk saatlerinde gerçekleşen saldırı nedeniyle sistem bir süre kilitlendi. Daha sonrasında bozulan düğüm nedeniyle bazı kullanıcılar birden fazla oy verebildiklerini belirttiler. Güvenlik sorunlarının gerçekleşmesi beklenen bir durumdu. 2005’den beri elektronik oylama kullanan Estonya’da oylamalar fiziksel çipler ile yapılmasını gerektiren bir kriptografi algoritması ile donanmış olsa da hala bazı güvenlik eleştirileri yer alıyor.</p><p>İlk denemedeki başarısızlık sonrası Rusya başka bir şirket ile anlaştı. Waves Enterprise ortaklığında kurulacak yeni sistemde, ilk sistemdeki başarısızlığı önlemek için sıfır bilgi kanıtı mutabakat mekanizması kullanılacak. Güçlü kriptografik algoritmalar ile desteklendiğinde merkeziyetsiz yapıdan tam olarak yararlanılabilecek ve bu şekilde saldırılar büyük ölçüde engellenecektir. Oylama sonucunda istatistiklere ulaşabilmek için yetkililer farklı kişilere dağıtılmış 5 farklı özel anahtarı birleştirecekler. Bu sistemin ilk kullanımı Devlet Duması seçimlerinde Kurskaya ve Yaroslavskaya bölgelerinde gerçekleşecek. 13 Eylül 2020’de 600,000’in seçmenin oy kullanacağı bu seçim, gelecek elektronik oylamalar için bir dönüm noktası olabilir.</p><h3>Bizi Takip Edin</h3><p><a href="https://blockchainist.org/">Web Sitemiz</a></p><p><a href="https://twitter.com/BCISTCenter">Twitter</a></p><p><a href="https://www.linkedin.com/company/blockchainist-center/">LinkedIn</a></p><p><a href="https://www.instagram.com/bcistcenter/">Instagram</a></p><p><a href="https://www.youtube.com/channel/UCI-McyMd08P8O5I_aMpa5Vg">YouTube</a></p><p><a href="https://t.me/blockchainistcenter">Telegram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38680d09a20b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>