<?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 Aman Kanojiya on Medium]]></title>
        <description><![CDATA[Stories by Aman Kanojiya on Medium]]></description>
        <link>https://medium.com/@a.kanojiya2003?source=rss-9ef93b00a2bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pyVyZwzcaWN7RTuug0-9nw.jpeg</url>
            <title>Stories by Aman Kanojiya on Medium</title>
            <link>https://medium.com/@a.kanojiya2003?source=rss-9ef93b00a2bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 19:22:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@a.kanojiya2003/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[Barcode Scanner to Backend: Deep Understanding of Bluetooth SPP with Go in Industrial Systems]]></title>
            <link>https://medium.com/@a.kanojiya2003/barcode-scanner-to-backend-deep-understanding-of-bluetooth-spp-with-go-in-industrial-systems-729f7ef6b980?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/729f7ef6b980</guid>
            <category><![CDATA[protocol]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[industry]]></category>
            <category><![CDATA[bluetooth]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Tue, 11 Nov 2025 06:27:57 GMT</pubDate>
            <atom:updated>2025-11-11T06:27:57.696Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>How to bridge Bluetooth scanners, virtual serial ports, and industrial systems using Go.</blockquote><p>Bluetooth in consumer devices usually means music in your headphones or notifications on your smartwatch. In industrial environments, the story is much simpler and much more brutal: <em>“I had a serial cable. I want it gone. Don’t make me reinvent my whole system.”</em></p><p>That’s exactly what Bluetooth SPP ( Serial Port Profile ) — was designed for. It’s not glamorous, but it quietly powers barcode scanners, handheld terminals, GPS receivers, and all kinds of industrial gadgets that just want to send a stream of bytes to a host. In this article, we’ll go beyond the shallow “SPP is a virtual serial port” explanation and dig into how it actually works, how operating systems expose it, and how to wire it into a robust Go backend that can power serious warehouse or factory workflows.</p><h3>Where Bluetooth SPP Lives in the Stack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*EyIQcT8xeR5CoiYd6toSFg.png" /></figure><p>To understand SPP properly, you have to place it in the Bluetooth Classic stack. Bluetooth isn’t a single layer — it’s a small protocol city: baseband radio at the bottom, logical channels in the middle, and then “profiles” at the top that define specific behaviors.</p><p>SPP sits in the profile layer. More specifically, it is a profile built on top of RFCOMM, which itself emulates an RS-232 serial link over Bluetooth. RFCOMM provides the illusion of multiple serial channels — like multiple virtual COM ports — carried over a single Bluetooth link. Below RFCOMM, L2CAP handles packet segmentation and multiplexing, and beneath that lie the link manager, baseband, and radio.</p><p>Your Go app doesn’t talk to RFCOMM/L2CAP directly.<br>The OS Bluetooth stack does that and then exposes:</p><ul><li>COM3, COM4, … (Windows)</li><li>/dev/tty.* (macOS)</li><li>/dev/rfcomm0, /dev/ttyS* (Linux)</li></ul><p>That’s the <strong>illusion</strong>: your app thinks, “I’m just reading from a serial port,” but under the hood it’s a layered Bluetooth stack.</p><h3>Why Industrial Systems Still Love SPP</h3><p>Given all the newer options — BLE, Wi-Fi, MQTT, cloud-connected devices — it’s fair to ask why SPP is still so common in warehouses and factories. The answer is that SPP is boring in the best possible way.</p><p>Most industrial and warehouse systems grew up around serial ports. Scales, label printers, barcode scanners, PLC bridges, and many other devices talk plain RS-232 or UART. Backend software that controls them was written with a very simple model in mind: open a serial port, read a line, parse it, update a database or send a command back. SPP lets hardware vendors turn that exact protocol into a wireless one without touching the application-level behavior. Instead of sending those bytes down copper, they just send the same bytes over RFCOMM.</p><p>From the host’s point of view, the Bluetooth stack, pairing, link encryption, and reconnection are all handled by the operating system. Your Go service doesn’t “speak Bluetooth.” It simply opens a serial port. The same abstractions that worked with USB-serial adapters and physical COM ports still work with SPP devices. That is extremely attractive in environments where stability and compatibility matter much more than fashion.</p><p>Performance-wise, SPP more than satisfies the needs of barcode scanners. A barcode payload is tiny — dozens of bytes, maybe a few hundred — and human operators simply can’t scan fast enough to saturate a Bluetooth link. The real challenges in these systems aren’t throughput; they’re robustness, interference, and clean integration with backends and UI.</p><h3>End-to-End Architecture: Barcode → Go → Industrial Backend</h3><p>Let’s zoom out and see how the whole system fits together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkwBbTWnkbVUpyvyrI2uVA.png" /><figcaption>common industrial architecture</figcaption></figure><p>Flow :</p><ul><li><strong>Scanner:</strong> Bluetooth SPP barcode scanner</li><li><strong>Host OS:</strong> Windows/macOS/Linux, with Bluetooth enabled</li><li><strong>Virtual serial port:</strong> OS-created device (COMx, /dev/tty.*, /dev/rfcomm0)</li><li><strong>Go service:</strong> Reads serial, parses, routes</li><li><strong>Backend/UI:</strong> WMS/ERP/MES, dashboards, WebSocket UIs, etc.</li></ul><p>Let’s follow a single barcode scan through the system. An operator points a Bluetooth scanner at a label and pulls the trigger. The scanner decodes the barcode locally and sends a short burst of data over an RFCOMM channel via Bluetooth Classic. The host operating system, which has already paired with the scanner, receives those RFCOMM frames and hands the aggregated bytes to a virtual serial driver. That driver writes them into the serial device that your Go program has opened.</p><p>Inside your Go process, you probably have a goroutine that sits in a read loop on that serial port, accumulating incoming bytes until it encounters a newline or other terminator. At that moment, the barcode string is complete. You wrap it into a small struct with metadata — time, scanner identity, station or zone — and push it into your internal pipeline. Downstream components decide what the scan means: maybe it represents an item entering a zone, maybe it confirms a pick, maybe it ties a package to a shipment.</p><p>A typical industrial system doesn’t stop there. Many warehouses display scans in real time on browser-based UIs. In that setup, your Go service doubles as a WebSocket hub. The SPP/serial reader produces scan events, the WebSocket layer broadcasts them to subscribed clients, and browser dashboards update immediately so operators can see exactly which barcodes just flowed through their station.</p><h3>Deep Dive: OS Pairing and SPP Ports</h3><h3>1 Windows</h3><ol><li>Pair scanner via <strong>Bluetooth settings</strong>.</li><li>Open <strong>Device Manager → Ports (COM &amp; LPT)</strong>.</li><li>You’ll see something like:</li></ol><ul><li>Standard Serial over Bluetooth link (COM5)</li></ul><p>4. Use COM5 in Go.</p><h3>2 macOS</h3><ul><li>Pair the scanner in <strong>System Settings → Bluetooth</strong>.</li><li>Check /dev/tty.*:</li></ul><pre>ls /dev/tty.*</pre><ul><li>You’ll see entries like:</li><li>/dev/tty.HONEYWELL_SCANNER-SerialPort</li><li>/dev/tty.Bluetooth-Incoming-Port</li></ul><p>Pick the one corresponding to the scanner.</p><h3>3 Linux</h3><p>Linux is flexible but a bit more manual:</p><ul><li>Pair device with bluetoothctl.</li><li>Bind an RFCOMM device:</li></ul><pre>sudo rfcomm bind /dev/rfcomm0 &lt;BT_MAC_ADDRESS&gt;</pre><p>Now /dev/rfcomm0 behaves like a serial device.</p><p>You can make this persistent via:</p><ul><li>Systemd service</li><li>udev rules</li><li>or a boot-time script</li></ul><h3>Go Integration: Robust Serial Reading with SPP</h3><p>Once the OS gives you a port, Go can take over. It’s tempting to write a quick proof-of-concept that opens the port, calls Read in a loop, and prints whatever arrives. That’s fine for your first experiment, but production systems need a bit more structure.</p><p>A good SPP integration layer in Go encapsulates several responsibilities: opening the port with proper parameters, reading line-oriented data, reconnecting when things go wrong, and pushing clean events to the rest of the system via channels or other message abstractions. A popular cross-platform serial library in Go is go.bug.st/serial, which treats serial ports in a uniform way on Windows, macOS, and Linux.</p><p>Here is a sketch of a scanner loop that embodies these ideas. Each successful read produces a ScanEvent with scanner metadata and the decoded barcode:</p><pre><br>package spp<br><br>import (<br>    &quot;bufio&quot;<br>    &quot;context&quot;<br>    &quot;log&quot;<br>    &quot;strings&quot;<br>    &quot;time&quot;<br><br>    &quot;go.bug.st/serial.v1&quot;<br>)<br><br>type ScanEvent struct {<br> ScannerName string<br> Port        string<br> Barcode     string<br> Timestamp   time.Time<br>}<br><br>type ScannerConfig struct {<br> Name         string<br> Port         string<br> BaudRate     int<br> ReconnectSec int<br>}<br><br>func RunScanner(ctx context.Context, cfg ScannerConfig, out chan&lt;- ScanEvent) {<br> if cfg.BaudRate == 0 {<br>  cfg.BaudRate = 9600<br> }<br> if cfg.ReconnectSec == 0 {<br>  cfg.ReconnectSec = 5<br> }<br><br> for {<br>  if err := runOnce(ctx, cfg, out); err != nil {<br>   log.Printf(&quot;[scanner=%s] error: %v, reconnecting in %ds&quot;, cfg.Name, err, cfg.ReconnectSec)<br>  }<br><br>  select {<br>  case &lt;-ctx.Done():<br>   log.Printf(&quot;[scanner=%s] stopping&quot;, cfg.Name)<br>   return<br>  case &lt;-time.After(time.Duration(cfg.ReconnectSec) * time.Second):<br>  }<br> }<br>}<br><br>func runOnce(ctx context.Context, cfg ScannerConfig, out chan&lt;- ScanEvent) error {<br> mode := &amp;serial.Mode{BaudRate: cfg.BaudRate}<br> port, err := serial.Open(cfg.Port, mode)<br> if err != nil {<br>  return err<br> }<br> defer port.Close()<br><br> log.Printf(&quot;[scanner=%s] opened %s&quot;, cfg.Name, cfg.Port)<br><br> reader := bufio.NewReader(port)<br><br> for {<br>  select {<br>  case &lt;-ctx.Done():<br>   return ctx.Err()<br>  default:<br>  }<br><br>  line, err := reader.ReadString(&#39;\n&#39;)<br>  if err != nil {<br>   return err<br>  }<br><br>  barcode := strings.TrimSpace(line)<br>  if barcode == &quot;&quot; {<br>   continue<br>  }<br><br>  event := ScanEvent{<br>   ScannerName: cfg.Name,<br>   Port:        cfg.Port,<br>   Barcode:     barcode,<br>   Timestamp:   time.Now(),<br>  }<br><br>  select {<br>  case out &lt;- event:<br>  case &lt;-ctx.Done():<br>   return ctx.Err()<br>  }<br> }<br>}</pre><h3>Conclusion</h3><p>Bluetooth SPP is not a new or flashy technology, but that’s exactly why it fits industrial environments so well. It takes decades of serial-port habits and wraps them in a wireless transport that operating systems understand deeply. In Go, you don’t have to be a Bluetooth expert to integrate SPP devices. You simply need to respect the serial abstraction, design a robust reader loop, treat device identity as a core concept, and build a clean pipeline from raw scan to business event.</p><p>Once you structure your code around ScanEvents rather than “lines from a port,” a lot of architectural doors open: live dashboards, audit logs, event sourcing, analytics, and integrations with warehouse management or ERP systems. All of that starts with a single clean idea: a Bluetooth SPP scanner is just a serial device that happens to be wireless, and Go is very good at talking to serial devices.</p><p>If you want, we can next refine this into your preferred voice (more casual, more corporate, more “documentation-style”) or carve out smaller spin-off articles: one focused entirely on the protocol internals, another on the Go WebSocket push architecture, and another on deployment patterns in factories and warehouses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/0*ZbX9g7oHTw1Mihp5.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=729f7ef6b980" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Machines Talk: Behind Industrial Automation]]></title>
            <link>https://medium.com/@a.kanojiya2003/how-machines-talk-behind-industrial-automation-63db06df6120?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/63db06df6120</guid>
            <category><![CDATA[industry]]></category>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[modbus]]></category>
            <category><![CDATA[modbus-tcp]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Fri, 07 Nov 2025 08:56:55 GMT</pubDate>
            <atom:updated>2025-11-07T08:56:55.224Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Modbus" src="https://cdn-images-1.medium.com/max/386/0*oFBRwd-sZSnIHuyU" /></figure><p>“From coils to holding registers, here’s how Modbus helps devices talking across your factory floor.”</p><h3>When your machines start talking…</h3><p>Imagine standing in the middle of a humming factory. Pipes hiss, motors spin, lights blink. But beneath all that noise, there’s another layer of conversation started suddenly ( maybe you might have received a super natural power ) — silent, invisible, and constant.</p><blockquote><em>PLC: “Sensor #1, what’s your pressure reading?”<br>Sensor #1: “Steady at 101.3 kPa!”<br>PLC: “Good. Motor #3, start spinning at 60 Hz.”<br>Motor: “Roger that, boss.”</em></blockquote><p>Wait what you just heard whats going on here hmm…</p><p>That’s <strong>Modbus</strong> — the protocol that lets machines gossip about the data they are processing currently. It’s not glamorous. It doesn’t use fancy JSON, REST APIs, or GraphQL. But it <strong>just works</strong>, even in dusty factories older than your Wi-Fi router.</p><h3>What Is Modbus (And Why Should You Care)?</h3><p>Modbus was invented in <strong>1979</strong> by <strong>Modicon</strong>, a company that made PLCs (Programmable Logic Controllers). Back then, connecting machines meant soldering wires and praying nothing caught fire. Modbus made that process… <em>civilised and pretty safe </em>😅<em>.</em></p><p>Think of it as a <strong>translator for machines</strong> — a way for different devices (made by different manufacturers) to exchange data in a standard, predictable way. Today, over 45 years later, it’s still used everywhere — from power grids to breweries.</p><h3>Why Modbus Endures</h3><ul><li><strong>Open</strong>: Free to implement, no license required (Open Protocol).</li><li><strong>Simple</strong>: Uses plain numeric addresses — no metadata or complicated Structures.</li><li><strong>Versatile</strong>: Works over serial (RS-485), modern Ethernet and different protocol.</li><li><strong>Reliable</strong>: Proven in factories, mines, ships, and smart buildings.</li></ul><blockquote><em>Think of Modbus like that old Nokia phone: no touchscreen, no apps — but it’ll still outlive your latest flagship phone.</em></blockquote><h3>Architecture: Modbus Conversations</h3><p>The Modbus world is organised like a classroom:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6RP5BlSQJOtC2DwOqghrw.png" /><figcaption>Master Slave Arch</figcaption></figure><ul><li>The <strong>Master (Client)</strong> asks all the questions.</li><li>The <strong>Slaves (Servers)</strong> only answer when asked.</li></ul><p>Each slave has a <strong>unique address</strong> (like student roll numbers), so the master knows who’s talking.</p><h3>How They Talk — Physical Layers</h3><p><strong>Modbus RTU — </strong>RS-485 (Serial) <em>Industrial wiring (up to 1200 m)</em></p><p><strong>Modbus ASCII — </strong>Serial (text-based) <em>Easy debugging, slow networks</em></p><p><strong>Modbus TCP — </strong>Ethernet (TCP/IP) <em>Modern automation &amp; IoT</em></p><p>RTU and ASCII are serial — meaning one wire loop connects all devices in a “party line.” TCP brings Modbus into the Ethernet era.</p><h3>The Modbus Data Model</h3><p>Each Modbus device exposes data through <strong>logical tables</strong>, not variables or objects. These tables are arranged into four categories:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UiuunxShrnSR_SNWy-oi2Q.png" /></figure><blockquote>Each <strong>register</strong> holds 16 bits (2 bytes).<br>Need 32-bit or floating-point data? Use <strong>two consecutive registers</strong>.</blockquote><pre>Memory Map Example :<br><br>+----------+--------------------+------------------------------+<br>| Address  | Type               | Example                      |<br>+----------+--------------------+------------------------------+<br>| 00001    | Coil               | Motor ON/OFF                 |<br>| 10001    | Discrete Input     | Door Sensor State            |<br>| 30001    | Input Register     | Pressure (in PSI)            |<br>| 40001    | Holding Register   | Set Temperature (°C)         |<br>+----------+--------------------+------------------------------+</pre><p>You can imagine it like a big spreadsheet inside the device — every row is a bit or word representing some real-world value.</p><h3>Message Flow — ( Req–Res ) Cycle</h3><p>Modbus communication follows a predictable rhythm.</p><pre>Master → “Device #5, give me holding registers 40001–40002.”<br>Slave  → “40001 = 1200, 40002 = 800.”</pre><p>That’s it — <strong>no handshakes</strong>, no “acknowledge” or “keep-alive” signals. If something’s wrong, the device sends back an <strong>exception code</strong> (like “Illegal Address” or “Function Not Supported”).</p><h3>The Frame Format — Message Anatomy</h3><p>Every Modbus message (frame) has a structure depending on the mode (RTU, ASCII, or TCP).</p><h4>-&gt; Modbus RTU Frame (Binary Serial)</h4><pre>+----------+-------------+-----------+------------+<br>| Address  | Function    | Data      | CRC Check  |<br>| (1 byte) | (1 byte)    | (n bytes) | (2 bytes)  |<br>+----------+-------------+-----------+------------+</pre><h4>Request: (read 2 holding registers starting at 40001)</h4><pre>[01][03][00][00][00][02][C4][0B]</pre><ul><li>01 → Slave address</li><li>03 → Function code (Read Holding Register)</li><li>00 00 → Starting address</li><li>00 02 → Number of registers</li><li>C4 0B → CRC checksum</li></ul><p><strong>Response:</strong></p><pre>[01][03][04][00][10][00][27][B9][F8]</pre><p>Two registers: 0x0010 (16), 0x0027 (39)</p><h4>-&gt; Modbus TCP Frame (Ethernet)</h4><pre>+------------+--------------+-----------+<br>| MBAP Header| Function Code| Data      |<br>+------------+--------------+-----------+</pre><p>The <strong>MBAP Header</strong> contains:</p><pre>Transaction ID | Protocol ID | Length | Unit ID</pre><p>It’s basically the same message wrapped in Ethernet clothes — no CRC (Ethernet handles errors).</p><h3>Function Codes — The Verbs of Modbus</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*fpTvvWc3xf5itByVxPE8Pw.png" /></figure><p>When something is wrong, the function code is “flipped” by adding 0x80.<br>So, if you send 0x03 and the device returns 0x83, you know it’s complaining.</p><h3>Golang Example — Reading Registers</h3><p>Let’s implement a simple Modbus TCP client in Go.<br>We’ll connect to a temperature sensor and read its holding register (40001).</p><pre>package main<br>import (<br>	&quot;fmt&quot;<br>	&quot;log&quot;<br>	&quot;time&quot;<br>	&quot;github.com/goburrow/modbus&quot;<br>)</pre><pre>func main() {<br>	handler := modbus.NewTCPClientHandler(&quot;192.168.0.10:502&quot;)<br>	handler.SlaveId = 1<br>	handler.Timeout = 5 * time.Second</pre><pre>	err := handler.Connect()<br>	if err != nil {<br>		log.Fatalf(&quot;Failed to connect: %v&quot;, err)<br>	}<br>	defer handler.Close()</pre><pre>	client := modbus.NewClient(handler)</pre><pre>	// Read one holding register starting at 0<br>	results, err := client.ReadHoldingRegisters(0, 1)<br>	if err != nil {<br>		log.Fatalf(&quot;Read failed: %v&quot;, err)<br>	}</pre><pre>	value := uint16(results[0])&lt;&lt;8 | uint16(results[1])<br>	fmt.Printf(&quot;Temperature = %d°C\n&quot;, value)<br>}</pre><p>If your register contains scaled data (like 2500 for 25.00°C), just divide accordingly.</p><h3>Strengths and Weaknesses</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*zCK5haNZj0c8j3k0MI7A7w.png" /></figure><blockquote><em>Modbus doesn’t care what your data </em>means<em>.<br>A register might store anything — your software must know the context.</em></blockquote><h3>Real-World Use Cases</h3><ul><li><strong>Factory Automation</strong> — PLCs controlling conveyor belts.</li><li><strong>Energy Monitoring</strong> — Smart meters sending voltage/current readings.</li><li><strong>HVAC Systems</strong> — Thermostats and fans managed via Modbus TCP.</li><li><strong>IoT Gateways</strong> — Bridging legacy sensors to the cloud via MQTT.</li></ul><p>Even modern cloud dashboards often still talk to legacy Modbus devices — it’s like putting an old fax machine on Wi-Fi.</p><h3>Wrapping It All Up</h3><p>Modbus is like that <strong>old reliable coworker</strong> — quiet, old-fashioned, but your entire operation collapses without them.</p><p>It doesn’t care about modern trends like REST APIs or encryption.<br>But it’s consistent, efficient, and perfect for real-world machines that just need to say:<br>“Here’s my data, take it or leave it.”</p><p>This is just the Introduction part, In my next artical i will walk you through more details in Industry level protocol system and in interested we will explore the exploits used to capture these devices</p><h3>TL;DR</h3><blockquote><strong><em>Modbus = The WhatsApp of machines.</em></strong><em><br>No emojis, no typing indicators, just rock-solid data since 1979.</em></blockquote><figure><img alt="MEME" src="https://cdn-images-1.medium.com/max/1024/0*DbzDTgJa87T6qVHy" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63db06df6120" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Container Unplugged: How Docker Utilizes Linux Namespaces and Chroot]]></title>
            <link>https://medium.com/@a.kanojiya2003/container-unplugged-how-docker-utilizes-linux-namespaces-and-chroot-2dd87d133a53?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dd87d133a53</guid>
            <category><![CDATA[chroot]]></category>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[namespaces]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Wed, 22 May 2024 04:27:15 GMT</pubDate>
            <atom:updated>2024-05-22T04:27:15.442Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/541/0*0aAbIX1F9vQSSyPb.jpg" /></figure><p><em>Exploring the Key to Seamless Application Deployment with Docker&#39;s Toolbox</em></p><p><strong>Container:</strong> This word is everywhere these days in the development world, and Many of us are familiar with the concepts of containerization and images, facilitated by Docker and its powerful runtime, thanks to the widespread adoption of containerization and Docker.</p><p>But have you ever wondered how this unique piece of technology works? I&#39;m sure you&#39;ve had this thought cross your mind before. Well, wonder no more! In a series of articles, I&#39;ll be delving into all the essentials needed to get this revolutionary technology. It&#39;s changed the game in deployment and made our lives much more accessible.</p><p>Whether you&#39;re a pro developer wanting a quick review or a beginner keen to learn the basics, this series has you covered. Prepare for a fun journey through containerization, Docker, and how they&#39;ve changed software development. Let&#39;s dive in and discover the secrets behind this awesome tech!</p><h3><strong>Basic Introduction</strong></h3><p><strong>Container:</strong> A container is a lightweight, standalone, and executable package that includes everything needed to run a piece of software: the code, runtime, system tools, libraries, and settings. Containers ensure that an application runs consistently across different computing environments by abstracting away differences in OS distributions and underlying infrastructure. (Take note it doesn&#39;t contain all the OS-related content like the kernel )</p><p><strong>Container Runtime: </strong>A container runtime is a low-level component responsible for running containers. It handles the creation, execution, and management of container lifecycles. The container runtime interacts directly with the operating system&#39;s kernel to create the isolated environments that containers run in. ( This is the one that created Isolation and security between resources )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*s-jLh-2OmXxljOy52jaOhw.png" /><figcaption><em>Different container runtime (</em><a href="https://www.youtube.com/watch?v=JOsWB50LmwQ&amp;ab_channel=Earthly">https://www.youtube.com/watch?v=JOsWB50LmwQ&amp;ab_channel=Earthly</a><em>)</em></figcaption></figure><p><strong>Docker:</strong> Docker is a containerization platform that simplifies application development, deployment, and management. It provides tools and a runtime environment to create, deploy, and run container applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*XBoePFguo7bkaEwMATqKcQ.png" /></figure><h3>How Containerization Works</h3><p>Now, we have an overview of what a container is. This will make it easier to understand what its internal workings are. Containerization uses specific features of the Linux kernel to create isolated environments for running applications. The core concepts and components involved are namespaces, control groups (groups), chroot, and union file systems.</p><blockquote>In one talk in Docker con EU, Mr. Jérôme Petazzoni said “A Container feels like a VM, but it’s Just Chroot on steroids.”</blockquote><h4>1. Namespaces</h4><p>Namespaces provide isolated environments for processes, effectively creating separate instances of global system resources. Key namespaces include:</p><ul><li>PID Namespace: Isolates process IDs so that processes in one container do not see processes in another container or on the host system.</li><li>Network Namespace: Provides each container with its network stack, including interfaces, IP addresses, and routing tables.</li><li>Mount Namespace: Isolates the file system, giving each container its view of the file system hierarchy.</li><li>User Namespace: Isolates user and group IDs, allowing containers to have their own user and group settings independent of the host.</li><li>UTS Namespace: Isolates hostname and domain name, enabling containers to have their hostname.</li><li>IPC Namespace: Isolates inter-process communication resources like message queues, semaphores, and shared memory.</li></ul><h4>2. Control Groups (cgroups)</h4><p>Control groups (cgroups) are a feature of the Linux kernel that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network) of a group of processes. This ensures that containers can be allocated specific resources and prevents any single container from consuming too much of the host&#39;s resources.</p><h4>3. chroot</h4><p>chroot changes the root directory for a process and its children to a new location in the file system. This isolates the process&#39;s view of the file system, making it think it is running in its environment.</p><h4>4. Union File Systems</h4><p>Union file systems (UnionFS) are used to manage file systems in containers. They allow multiple file systems to be layered, creating a single unified file system. This is particularly useful for:</p><ul><li>Base Image Layers: Immutable layers that form the foundation of a container&#39;s file system.</li><li>Read-Write Layer: The top layer where changes and additions are made during the container&#39;s runtime.</li></ul><p>Containers are designed to be lightweight and efficient. One of the ways Docker achieves this is by sharing the host system&#39;s kernel across all running containers rather than creating separate kernels for each container. This contrasts with virtual machines (VMs), which require their operating systems and kernels</p><h3>How Docker Works and How It Utilizes Containerization</h3><p>Docker is a platform that automates the deployment of applications inside lightweight, portable containers. It leverages several underlying technologies to provide a seamless and efficient containerization experience. Here&#39;s a detailed breakdown of how Docker works and how it utilizes containerization features:</p><h4>Docker Engine</h4><p>The Docker Engine is the core component of Docker. It consists of three main parts:</p><ul><li><strong>Docker Daemon</strong> (dockerd): The background service running on the host machine is responsible for building, running, and managing Docker containers.</li><li><strong>Docker Client</strong> (docker): The command-line interface that users interact with to communicate with the Docker daemon.</li></ul><h4>Docker Images</h4><p>Docker images are templates used to create containers. They are built from a series of read-only layers, each representing a stage in the image&#39;s creation. Docker images are defined by a Dockerfile, which contains the instructions for building the image.</p><ul><li>Dockerfile: A text file with a series of instructions on how to build a Docker image. Typical instructions include FROM (to specify the base image), COPY (to copy files into the image), and RUN (to run commands during the build process).</li></ul><h4>Docker Containers</h4><p>Docker containers are instances of Docker images. They are lightweight and run in isolation on the host system. Containers are created using the docker run command and are managed by the Docker daemon.</p><h4>Container Lifecycle</h4><ul><li>Build: The Docker daemon builds an image from a Dockerfile, creating a series of read-only layers.</li><li>Deploy: The image is pushed to a registry (like Docker Hub), where it can be pulled by other hosts.</li><li>Run: The docker run the command creates a container from the image, setting up namespaces, groups, and the file system.</li><li>Manage: Containers can be started, stopped, and deleted using Docker commands (docker start, docker stop, docker rm).</li><li>Remove: Containers and images can be removed to free up system resources.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*0ioNxCg9dgD429Rh9M5vxA.png" /></figure><p>So, these are the building blocks of containerization and how it is structured. The following article will dive deeper into creating a custom container runtime using chroot and namespaces to understand containerization&#39;s internals better. This step-by-step guide will provide a hands-on experience, allowing you to see the intricacies behind the scenes and appreciate the simplicity and elegance of this powerful technology.</p><p>Let&#39;s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dd87d133a53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating the Web’s Hidden Helpers]]></title>
            <link>https://medium.com/@a.kanojiya2003/navigating-the-webs-hidden-helpers-8bfa2bd84016?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bfa2bd84016</guid>
            <category><![CDATA[f5-loadbalancer]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[technolog]]></category>
            <category><![CDATA[proxy]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Wed, 12 Jul 2023 12:07:21 GMT</pubDate>
            <atom:updated>2023-07-12T12:07:21.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*2PBJLhVRKHeE3hKRsQr_VQ.png" /></figure><blockquote>Exploring the Depths of Proxies and Reverse Proxies</blockquote><p>Welcome, fellow adventurers, to the thrilling world of proxies and reverse proxies! Picture this: you’re navigating the vast digital realm like a daring explorer charting new territories. Suddenly, you encounter a mysterious entity, a hidden force between you and your destination. Fear not, for this enigmatic entity is none other than the mighty proxy and its alter ego, the reverse proxy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/0*09JomNMSZABxdn6h.jpeg" /></figure><p>Imagine you’re on a quest to access a coveted treasure trove of information — a website, perhaps. As you navigate the intricate web of servers, you encounter a proxy, a charismatic middleman who swiftly intercepts your request and carries it on its broad virtual shoulders. This proxy serves as a guide, leading you through the labyrinthine corridors of the internet, all while adding a touch of spice and excitement to your journey.</p><p>Now, let’s delve deeper into the realms of these digital superheroes, with a grand example that brings their powers to life.</p><p><strong><em>Example: Enhancing Web Performance with Proxy and Reverse Proxy</em></strong></p><p><em>Imagine you’re an enthusiastic online shopper searching for the perfect pair of sneakers. You visit an e-commerce website, expecting a smooth and seamless experience. Little do you know that proxy and reverse proxy servers silently work in the background, enhancing your journey remarkably.</em></p><h3>Proxy Servers</h3><p><strong>Streamlining Communication and Security</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NgSgmf2IV0AaEycK.png" /></figure><p>A proxy is an intermediary server that acts as a bridge between a client and a destination server. When a client sends a request to access a resource, such as a website or a file, the proxy server receives the request on behalf of the client. It then forwards the request to the destination server and relays the response to the client. The essential purpose of a proxy is to facilitate communication between the client and the server while providing additional functionalities like caching, security, and privacy.</p><h3>Benefit :</h3><p><strong>a) Caching</strong>: Like a wise librarian, the proxy server stores frequently accessed website resources locally. When you request those resources again, the proxy can serve them directly from its cache, speeding up the process and reducing the load on the e-commerce platform’s servers. It’s like having instant access to your favorite books on a well-organized shelf.</p><p><strong>b)</strong> <strong>Bandwidth Optimization</strong>: Proxy servers can compress and optimize data, reducing the amount of data transmitted between your device and the website’s servers. This optimization improves the overall browsing experience, especially on slower connections, ensuring faster page load times and smooth navigation.</p><p><strong>c) Security and Anonymity</strong>: Proxy servers can act as a shield, safeguarding your device and identity from potential threats. They can filter out malicious content, block access to suspicious websites, and provide a layer of anonymity by masking your IP address. It’s like having a vigilant bodyguard protecting you while you shop.</p><h3>Reverse Proxy Servers</h3><h4><strong>Balancing Loads and Enhancing Security</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_wd_7ZbF4AN3cjyM.png" /></figure><p>A reverse proxy is a server that sits between clients and backend servers, acting as an intermediary on behalf of the servers. When a client sends a request to access a resource, the reverse proxy intercepts the request and forwards it to the appropriate backend server. The response from the server is then relayed back to the client by the reverse proxy. Unlike a traditional proxy, which forwards requests from clients to servers, a reverse proxy forwards requests from clients to servers on the server side of a network.</p><h3>Benefit :</h3><p><strong>a) Load Balancing</strong>: When multiple users access the e-commerce platform simultaneously, reverse proxies distribute incoming requests across a cluster of backend servers. This load-balancing technique prevents any single server from becoming overwhelmed, maintaining high availability and reducing the chances of slowdowns or crashes. It’s like having a traffic controller efficiently managing the flow of customers to different checkout counters.</p><p><strong>b) Security and DDoS Protection</strong>: Reverse proxies are the first defense against malicious attacks, including Distributed Denial of Service (DDoS) attacks. They can analyze incoming requests, filter out suspicious traffic, and mitigate potential threats, shielding the backend servers from harm. It’s like having a vigilant security team protecting the e-commerce platform from cyber intruders.</p><p><strong>c) TLS Termination</strong>: Reverse proxies excel in TLS termination, allowing them to handle SSL/TLS encryption and decryption on behalf of backend servers. Backend servers can focus on processing requests by offloading this computationally intensive task to the reverse proxy, improving performance and scalability. Additionally, it enables centralized management of SSL certificates, simplifying the maintenance and deployment of secure connections.</p><p><strong>d) Isolation of Internal Traffic</strong>: Reverse proxies act as a protective shield by isolating internal servers from direct external access. They serve as the entry point for external clients, ensuring that sensitive resources and backend infrastructure remain hidden and inaccessible. This isolation enhances security by reducing the attack surface and mitigating the risk of unauthorized access.</p><p><strong>e) Canary Development</strong>: Reverse proxies facilitate canary deployments, a technique used to test new or updated versions of applications or services on a small subset of user traffic. By directing a percentage of users to the latest version, organizations can collect real-time feedback, monitor performance, and identify potential issues before rolling out the changes to a broader audience. This controlled and gradual deployment minimizes the impact of any unforeseen problems and improves the overall stability and reliability of the system.</p><p><strong>f) Caching</strong>: Reverse proxies excel in caching frequently accessed resources, such as images, static files, or database queries. The reverse proxy can dramatically reduce response times and relieve the backend servers from repetitive requests by storing and serving these resources from memory or disk. This results in improved performance, lower server load, and enhanced scalability, especially during periods of high traffic or when dealing with computationally intensive operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*c0ToLfRJRgeG6ZODQZia3Q.jpeg" /></figure><p>In conclusion, proxies and reverse proxies are indispensable tools in computer networks and web architecture. Proxies act as intermediaries, optimizing communication, enhancing security, and improving performance through caching. They offer a range of benefits, including filtering malicious content and providing anonymity. Reverse proxies, on the other hand, serve as gatekeepers, balancing loads, enhancing security, and enabling advanced functionalities such as TLS termination, traffic isolation, canary development, and caching. These intermediaries ensure seamless and secure web experiences, empowering organizations to deliver faster, more reliable services to users.</p><p>With the continuous evolution of technology and the growing complexity of web applications, the importance of proxies and reverse proxies will only increase. They will continue to adapt and evolve, meeting the demands of a dynamic digital landscape. As businesses strive to provide optimal user experiences, leveraging the power of proxies and reverse proxies will remain a key strategy. By embracing these technologies, organizations can enhance performance, security, and scalability, ultimately delivering an exceptional web experience to users worldwide.</p><p>Let’s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bfa2bd84016" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Load Balancers: Layer 4 vs Layer 7]]></title>
            <link>https://medium.com/@a.kanojiya2003/load-balancers-layer-4-vs-layer-7-10403de51e44?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/10403de51e44</guid>
            <category><![CDATA[load-balancer]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[osi-model]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Fri, 07 Jul 2023 18:05:48 GMT</pubDate>
            <atom:updated>2023-07-07T18:05:48.821Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*WaWBJb_KTUcwHfF-Ts7EHQ.png" /></figure><blockquote>Choosing the Perfect Fit for Your Applications</blockquote><p>Have you ever wondered how large-scale applications handle heavy traffic and ensure seamless user experiences? The answer lies in load balancers, the unsung heroes of modern application architectures. Among the various types of load balancers, Layer 4 and Layer 7 load balancers are often the go-to choices. But what sets them apart? In this fascinating article, we journeyed to unravel the mysteries of Layer 4 and Layer 7 load balancers. Get ready to dive deep into their inner workings, discover their unique capabilities, and make informed decisions that optimize your application&#39;s performance and scalability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*cdBp-iM9ADnqHYxQd9LWTA.jpeg" /></figure><p>Let&#39;s start with understanding what a load balancer is. I expect you to have basic knowledge about it, but let me shed some light on it. A load balancer is like a friendly bouncer at a party, ensuring everyone enters smoothly without overwhelming the place. It&#39;s a device or software that acts as a traffic cop for incoming requests to a website or application. Like a bouncer directs people to different ticket booths at an amusement park, a load balancer directs requests to other servers, evenly distributing the load and ensuring a fast and reliable experience. It&#39;s like a superhero that detects server issues and quickly reroutes requests to keep the website running smoothly. So, think of a load balancer as a party bouncer or a helpful superhero managing web traffic for a seamless user experience. So why do we need to separate them into two different types? Now we will discuss it.</p><h3>Layer 4: LoadBalancer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_B3YurzIFcW30FyDGBMNpQ.png" /></figure><p>A Layer 4 load balancer operates as a traffic director for internet traffic at the transport layer. It intelligently distributes requests based on IP addresses and port numbers. Similar to a traffic cop at a busy intersection, it ensures a smooth flow of traffic by evenly distributing the incoming requests to different servers. Its primary goal is to balance the load across servers, preventing any single server from becoming overwhelmed. By efficiently managing the traffic, a Layer 4 load balancer helps improve performance and ensures a reliable user experience.</p><p>Layer 4 load balancers are particularly effective for protocols like TCP and UDP. They excel at handling high traffic volumes and ensuring that requests are directed to the most appropriate servers based on network-level information. With their efficient load-balancing capabilities, Layer 4 load balancers are crucial in optimizing application delivery and ensuring scalability for websites and applications.</p><h4><em>Pros</em></h4><p><em>Efficient traffic distribution based on IP addresses and port numbers, low latency for faster response times.</em></p><h4><em>Cons</em></h4><p><em>Need for more application awareness and ability to handle complex protocols.</em></p><h3>Layer 7: LoadBalancer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJmPnwBH8Fw5nPY-QCzShg.png" /></figure><p>A Layer 7 load balancer acts as an intelligent traffic manager, operating at the application layer of the networking stack. It goes beyond primary IP addresses and port numbers and considers application-specific information such as HTTP/HTTPS protocols, URL paths, cookies, and request content. Like a knowledgeable hotel concierge, it directs incoming requests to the most appropriate servers based on these application-level details, optimizing performance and ensuring efficient load balancing.</p><p>By understanding the intricacies of the application layer, a Layer 7 load balancer offers advanced features like content-based routing, SSL/TLS termination, and request/response rewriting. It is crucial in enhancing security, improving performance, and providing a seamless user experience. With its ability to make intelligent decisions based on application-specific criteria, a Layer 7 load balancer ensures that each request is directed to the most suitable server, making it an essential component for scalable and reliable application delivery.</p><h4><em>Pros</em></h4><p><em>advanced application awareness for intelligent routing based on specific requirements, enhanced security, and flexibility.</em></p><h4><em>Cons</em></h4><p><em>Increased processing overhead and potential performance impact due to deeper inspection and analysis.</em></p><p>How are we going to implement this load balancer? We can even implement it by ourselves, but we use alternates available in the market for ease, such as HAProxy and Nginx. In today&#39;s article, I will discuss HAProxy. Still, I can create a new piece to explain other available tools and their way of implementation. And if you want to implement it on your own, you can check my GitHub. I have implemented <a href="https://github.com/AMANKANOJIYA/Golang-Projects/tree/main/Loadbalancer"><em>Layer 4 LoadBalancer in GoLang</em></a>.</p><h3>HAProxy</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*d8kC7_QBZLQxiQmeMnE0pA.png" /></figure><p>HAProxy is an open-source load balancer and proxy server known for its high availability and scalability. Acting as a middleman between clients and servers, it intelligently distributes incoming requests across multiple servers, optimizing resource utilization. HAProxy operates at the application layer and offers various load-balancing algorithms. Thanks to its event-driven architecture, it excels handling numerous connections with low latency.</p><p>Below is the HAProxy Configuration file for the basic implementation of layer four and layer seven load balancer. You can refer to them.</p><h4>Implement Layer 4 LoadBalancer</h4><blockquote>In reference to above Architecture Image for Layer 4</blockquote><pre>global<br>  maxconn 5000<br><br>deafults<br>  log  global<br>  mode tcp<br>  timeout  connect  5000<br>  timeout client 50000<br>  timeout server 50000<br><br>frontend localnodes<br>  bind *:8080<br>  deafult_backend nodes<br><br>backend nodes<br>  server server-1 2.2.2.2:2222 check<br>  server server-2 3.3.3.3:3333 check<br>  server server-3 4.4.4.4:4444 check</pre><h4>Implement Layer 7 LoadBalancer</h4><blockquote>In reference to above Architecture Image for Layer 7</blockquote><pre>global<br>  maxconn 5000<br><br>deafults<br>  log  global<br>  mode http<br>  option httplog<br>  option dontlognull<br>  retries 3<br>  option redispatch<br>  maxcon 2000<br>  timeout  connect  5000<br>  timeout client 50000<br>  timeout server 50000<br><br>frontend localnodes<br>  bind *:8080<br>  mode http<br>  acl app1 patch_end -i /app1<br>  acl app1 patch_end -i /app1<br>  use_backend server-1 if LIK<br>  use_backend server-2 if CMT<br>  use_backend server-3 if PIC<br>  deafult_backend nodes<br><br>backend server-1<br>  mode http<br>  server app1server1 2.2.2.2:2222 check<br><br>backend server-2<br>  mode http<br>  server app1server2 3.3.3.3:3333 check<br><br>backend server-3<br>  mode http<br>  server app1server3 4.4.4.4:4444 check</pre><blockquote><a href="https://github.com/AMANKANOJIYA/Golang-Projects/tree/main/Loadbalancer">Implement Layer — 4 LoadBalancer</a></blockquote><blockquote>Implement Layer — 7 LoadBalancer</blockquote><p>To conclude, Layer 4 and Layer 7 load balancers, are vital in optimizing application delivery. Layer 4 load balancers focus on distributing traffic based on IP addresses and port numbers, while Layer 7 load balancers take application-specific information into account. Understanding the distinctions between these load balancer types is crucial for selecting the appropriate solution to enhance your application infrastructure&#39;s performance, scalability, and reliability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*BGHsVyFL72f_Se6Rumj_qQ.jpeg" /></figure><p>Let&#39;s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10403de51e44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering the Art of WebRTC]]></title>
            <link>https://medium.com/@a.kanojiya2003/mastering-the-art-of-webrtc-7a469ffa7ab0?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a469ffa7ab0</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[chat]]></category>
            <category><![CDATA[hands-on-tutorials]]></category>
            <category><![CDATA[webrtc]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Thu, 29 Jun 2023 12:27:19 GMT</pubDate>
            <atom:updated>2023-06-29T12:27:19.410Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*4bdLwWS43OVTlezA7qqhrQ.png" /></figure><p><em>&quot;Unleashing Real-Time Communication&#39;s Full Potential&quot;</em></p><p>Welcome to the final chapter of our WebRTC saga, where we dive deep into the heart of real-time communication. In this thrilling conclusion, we unravel the intricacies of WebRTC&#39;s flow, uncover its hidden gems, and equip you with the knowledge to embark on real-time communication adventures. Join us as we explore the final steps of the WebRTC journey and empower you to harness the true potential of this transformative technology.</p><h3>The WebRTC Flow</h3><ul><li>A wants to connect to B.</li><li>A creates an &quot;Offer,&quot; it finds all the ICE candidates, security options, and audio/video options and generates SDP; the offer is the SDP.</li><li>A signals the offer somehow to B (WhatsApp, Facebook chat, WebSocket, etc.)</li><li>B creates the &quot;answer&quot; after setting A&#39;s offer</li><li>B signals the &quot;answer&quot; to A</li><li>Connection is created</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sVRGpJGbfM7FApDEHkhHA.png" /></figure><h3>Hands-On with WebRTC</h3><p>Now that we have all knowledge let&#39;s have a basic setup and hands-on with this technology. We will not use any Framework, just open knowledge, So let&#39;s begin</p><p>1. Environment Setup</p><p>Open two browse side by side, and in both of them, open the developer console. Let&#39;s name the first Browser console User A and another browser after User B.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ow2XCu5YyRak0Xq1KyO2w.jpeg" /></figure><p>2. Generate ICE candidates for User A</p><pre>const localConnection = new RTCPeerConnection() </pre><p>before generating ICE candidates, we want the browser to print whenever a new ICE candidate is found so that we will add a trigger</p><pre>localConnection.onicecandidate = e =&gt;  {<br>console.log(&quot; NEW ICE candidate!! Reprinting SDP\n&quot; )<br> console.log(JSON.stringify(localConnection.localDescription))<br>}</pre><p>we will create a data channel through which the data will be transferred have to add some triggers to the data channel, which will help us know the status and response</p><pre>const sendChannel = localConnection.createDataChannel(&quot;sendChannel&quot;);<br>sendChannel.onmessage =e =&gt;  console.log(&quot;Message : &quot;  + e.data )<br>sendChannel.onopen = e =&gt; console.log(&quot;Channel Opened :\n&quot;);<br>sendChannel.onclose =e =&gt; console.log(&quot;Channel Closed :\n&quot;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ju_FwDARhdKkHTM_mTy_FQ.jpeg" /></figure><p>now we will generate all possible ICE candidates ( choose the latest one )</p><pre>localConnection.createOffer().then(o =&gt; localConnection.setLocalDescription(o) )</pre><p>4. Pass the ICE candidates to User B</p><p><em>(let your generated ICE candidates in place of an answer)</em></p><pre>const offer = {&quot;type&quot;:&quot;offer&quot;,&quot;sdp&quot;:&quot;v=0\r\no=- 578670941154304 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=application 59255 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 192.68.60.1\r\na=candidate:3354316281 1 udp 2122260223 192.168.60.1 59255 typ host generation 0 network-id 4\r\na=ice-ufrag:05Hs\r\na=ice-pwd:iiBVCTaJoIc8+y0Mt2rfsCe6\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DB:C3:08:A3:03:85:41:8D:30:1C:D5:F5:35:5F:6F:52:CB:24:48:B9:5F:D7:5B:82:82:D5:F4:43:19:F2:E7:1D\r\na=setup:actpass\r\na=mid:0\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n&quot;}</pre><p>lets create a connection and add the same triggers to the data channel</p><pre>const remoteConnection = new RTCPeerConnection()<br><br><br>remoteConnection.onicecandidate = e =&gt;  {<br>  console.log(&quot; NEW ice candidnat!! on localconnection reprinting SDP &quot; )<br>  console.log(JSON.stringify(remoteConnection.localDescription) )<br>}<br><br><br>remoteConnection.ondatachannel= e =&gt; {<br>   const receiveChannel = e.channel;<br>   receiveChannel.onmessage =e =&gt;  console.log(&quot;Message : &quot; + e.data )<br>   receiveChannel.onopen = e =&gt; console.log(&quot;Channel Opened :\n&quot;);<br>   receiveChannel.onclose =e =&gt; console.log(&quot;Channel Closed :\n&quot;);<br>   remoteConnection.channel = receiveChannel;<br>}<br><br>// Accepted the Connection <br>remoteConnection.setRemoteDescription(offer).then(a=&gt;console.log(&quot;done&quot;))</pre><p>5. Generate ICE candidate for User B</p><pre>await remoteConnection.createAnswer().then(a =&gt; remoteConnection.setLocalDescription(a)).then(a=&gt;<br>console.log(JSON.stringify(remoteConnection.localDescription)))</pre><p>6. Accepting ICE candidates of User A by User B</p><p><em>(paste your generated ICE candidates in place of an answer)</em></p><pre>const answer = {&quot;type&quot;:&quot;answer&quot;,&quot;sdp&quot;:&quot;v=0\r\no=- 1415901405343 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=application 65137 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 192.168.60.1\r\na=candidate:1442908678 1 udp 21222223 192.168.60.1 65137 typ host generation 0 network-id 4\r\na=candidate:1070929794 1 udp 2122194687 172.16.1.1 65138 typ host generation 0 network-id 5\r\na=candidate:3482159960 1 udp 2122129151 192.168.56.1 65139 typ host generation 0 network-id 6\r\na=candidate:2612850 1 udp 2121932543 192.168.180.8 65140 typ host generation 0 network-id 1 network-cost 10\r\na=candidate:3559996788 1 udp 2122066175 2409:4041:d90:e539:200a:6405:677:701c 65141 typ host generation 0 network-id 2 network-cost 10\r\na=candidate:427960212 1 udp 212200639 2409:4041:d90:e539:b257:56c3:3f29:63b2 65142 typ host generation 0 network-id 3 network-cost 10\r\na=ice-ufrag:4Ng6\r\na=ice-pwd:TmoZ/QgMo/O6TwGluL04tPb9\r\na=ice-options:trickle\r\na=fingerprint:sha-256 29:EF:08:D9:C8:A5:A9:1A:D7:D2:C1:D7:57:9E:39:5B:69:8E:3A:2A:85:D3:32:99:71:40:F3:2A:F1:8E:5D:04\r\na=setup:active\r\na=mid:0\r\na=sctp-port:5000\r\na=max-message-size:26144\r\n&quot;}<br><br>localConnection.setRemoteDescription (answer).then(a=&gt;console.log(&quot;done&quot;))</pre><p>7. It works !!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7EtdpO700EWH4AUAjKY08A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQp4Vy1UyOifUZKY99eR0g.jpeg" /></figure><h3>Best Practices for WebRTC Implementation</h3><ul><li><em>Bandwidth Management: Implement mechanisms to dynamically adjust media quality based on available bandwidth. This ensures optimal performance and a smooth user experience.</em></li><li><em>Security Considerations: Implement encryption using Secure Real-Time Transport Protocol (SRTP) to secure media streams and protect against eavesdropping.</em></li><li><em>Cross-Browser Compatibility: Test your WebRTC application across browsers to ensure compatibility and consistent behavior. Consider using browser compatibility libraries or frameworks to simplify cross-browser development.</em></li><li><em>Error Handling and Resilience: Implement robust mechanisms to gracefully handle failures and recover from errors during connection establishment, media streaming, and data exchange.</em></li><li><em>User Experience Optimization: Provide explicit feedback to users during connection establishment, media negotiation, and data exchange processes.</em></li></ul><p>As we reach the end of our WebRTC expedition, we stand in awe of the limitless possibilities that real-time communication holds. By understanding the intricate flow of WebRTC, mastering the art of signaling, establishing peer connections, managing media streams, and exchanging real-time data, you are now equipped to embark on your ventures in real-time communication. Let your imagination soar as you leverage this powerful technology to create innovative video conferencing, chat applications, gaming experiences, and more. The future of communication is within your grasp, so go forth and unleash the true power of WebRTC.</p><p>Let&#39;s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a469ffa7ab0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NAT and the Internet]]></title>
            <link>https://medium.com/@a.kanojiya2003/nat-and-the-internet-548a3cd4dc77?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/548a3cd4dc77</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[nat]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[ip]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Thu, 29 Jun 2023 07:50:48 GMT</pubDate>
            <atom:updated>2023-06-29T07:55:50.283Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooT8fF9mbbQv_iEzLKV3Og.png" /></figure><blockquote><em>“Bridging the Gap between Private and Public Domains”</em></blockquote><p>In the vast networking realm, Network Address Translation (NAT) plays a vital role in enabling seamless data flow across networks. It is a fundamental concept that allows multiple devices within a private network to share a single public IP address. NAT has become a crucial component in modern networking, addressing the growing need to utilize limited IP addresses and enhance network security efficiently. This article will delve into the world of NAT, exploring its purpose, functionality, and various types.</p><h3>What is NAT?</h3><p>Network Address Translation (NAT) is a technique used to map IP addresses between two networks. It acts as an intermediary between a private network (local network) and a public network (the Internet), providing a layer of abstraction for devices within the private network. NAT allows multiple devices to communicate using a public IP address with external networks.</p><p>So the question is, why do we need NAT Wi? th the rapid growth of internet-connected devices, the scarcity of public IP addresses has become a pressing issue. NAT provides a solution by allowing private IP addresses, which are non-routable within the public network, to be translated into a single public IP address. This conserves IP address space and enables private networks to access the Internet without requiring unique public addresses for each device.</p><h3>How NAT Works</h3><p>NAT operates by modifying IP addresses and port numbers within network packets as they pass through the NAT device. Different types of NAT employ various techniques for address translation, including:</p><h4>One to One NAT (Full-cone NAT)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0HILCDkDaM4fQ10ydkuHg.png" /></figure><p>One-to-One NAT, or Full-cone NAT, is a type of Network Address Translation where each internal private IP address is mapped to a unique external public IP address. It provides a direct and unrestricted communication pathway between internal and external devices. In this NAT configuration, any external device can initiate a connection to an internal device using the corresponding mapped public IP address and port.</p><h4>Address Restricted NAT</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6nZ8BbU_2oJZ-51Ejidh0g.png" /></figure><p>Address Restricted NAT is a type of NAT where the external device can initiate a connection to an internal device only if the internal device has previously initiated communication with the external device. Once the internal device establishes a relationship with an external device, the NAT mapping for that specific internal IP address and port is opened for incoming traffic from the external device.</p><h4>Port Restricted NAT</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jn2SmtKFBOaYca2b6ZnEbQ.png" /></figure><p>Port Restricted NAT is similar to Address Restricted NAT but with an additional restriction. In this NAT configuration, the external device can only initiate a connection to an internal device if the internal device has previously initiated communication with the external device using the same source port. The NAT mapping is opened only for incoming traffic from the external device if it matches the specific source port used in the previous outgoing.</p><h4>Symmetric NAT</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whs3kAIEjiA8uSdvSqJ4Og.png" /></figure><p>Symmetric NAT, also known as Endpoint-Independent Mapping, is a type of NAT where the mapping between internal and external IP addresses and ports is unique for each external destination. Each external communication from the internal device in this configuration results in a different external IP address and port combination. This provides a higher level of security but can introduce difficulties for specific applications that rely on consistent IP addresses and port mappings.</p><blockquote><em>A STUN server can deal with the upper three types of NAT, but getting ICE candidates and Connect using it is impossible. So, that&#39;s the main reason to use a TURN server or Relay server if Symmetric NAT is attached to user end</em></blockquote><h4>Benefits of NAT:</h4><ul><li>IP address conservation: NAT allows private networks to use personal IP addresses, reducing the demand for public IP addresses.</li><li>Enhanced security: By hiding private IP addresses from external networks, NAT acts as a firewall, providing an additional layer of protection.</li><li>Seamless connectivity: NAT enables devices within a private network to access the Internet using a shared public IP address, enabling communication with external networks.</li></ul><h4>Limitations of NAT:</h4><ul><li>Limitations for specific applications: NAT can introduce difficulties for applications that rely on direct peer-to-peer communication or require specific port configurations.</li><li>Impact on IP-based services: NAT can affect services such as VoIP, online gaming, and video conferencing, as they often require direct communication between devices.</li></ul><p>As we conclude our enchanting expedition through the captivating world of Network Address Translation (NAT), we leave behind the veils of mystery and embrace the profound knowledge we have gained. NAT, the hidden sorcerer of networking, weaves its spells to enable seamless communication, conserve IP addresses, and enhance network security. Armed with this newfound understanding, we can navigate the intricate landscapes of modern connectivity and unlock the true potential of our networks.</p><p>Let’s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=548a3cd4dc77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating WebRTC's Inner Realm]]></title>
            <link>https://medium.com/@a.kanojiya2003/navigating-webrtcs-inner-realm-5ac0eb8df2b7?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ac0eb8df2b7</guid>
            <category><![CDATA[sdp]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[turn]]></category>
            <category><![CDATA[ice]]></category>
            <category><![CDATA[stun]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 18:45:47 GMT</pubDate>
            <atom:updated>2023-06-28T18:45:47.394Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*4bdLwWS43OVTlezA7qqhrQ.png" /></figure><blockquote>“Exploring the Power of STUN, TURN, ICE Candidates, and SDP in Peer-to-Peer Communication”</blockquote><p>Our previous blog posts explored WebRTC&#39;s ability to facilitate seamless real-time communication. Today, we venture even further into the intricacies of WebRTC, shedding light on crucial components such as STUN, TURN, ICE candidates, and SDP (Session Description Protocol), which helps us to deal with NAT and related systems. Join us as we unravel the magic behind these technologies and their indispensable roles in enabling peer-to-peer communication. This blog may be longer but will ultimately create the base knowledge.</p><p>Let&#39;s start with understanding STUN and TURN</p><h3><strong>STUN ( Session Traversal Utilities around NAT)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OEC-a7CEqUq5o8Vh_nSmrg.png" /></figure><p>It is a protocol used in WebRTC to discover a device&#39;s public IP address and port hidden behind a NAT (Network Address Translation) router or firewall. NAT allows multiple devices on a private network to share a single public IP address, which helps conserve IP addresses. However, this introduces a challenge when establishing direct communication between devices.</p><p>STUN servers act as intermediaries between devices and help overcome this challenge. When a device wants to communicate with another apparatus, it sends a STUN request to a STUN server. The server responds with the device&#39;s public IP address and port as seen from the outside network. This information allows devices to determine how to establish a direct peer-to-peer connection, bypassing the NAT and enabling real-time communication.</p><p>Simplified Explanation: Imagine you are inside a house with multiple rooms, and each room has a person using a phone. When someone from one room wants to talk directly to someone in another room, they face a problem because each room has its extension number, and people from outside the house only know the main phone number. STUN servers act as messengers that help the callers discover their room numbers and connect directly, bypassing the main phone number.</p><h3>TURN ( Traversal Using Relays around NAT )</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4EUWa3a1Mo6S7F0tR4HEQ.png" /></figure><p>It is a relay server used in WebRTC to facilitate communication between devices when direct peer-to-peer connections are impossible due to restrictive network configurations. Devices may sometimes be behind symmetric NATs or firewalls that prevent direct contact.</p><p>When direct communication fails, devices can utilize TURN servers as intermediaries. TURN servers relay media and data packets between devices as a bridge. When a device sends data to another device, it is first sent to the TURN server, which then forwards it to the intended recipient. This ensures that communication can still occur, although with the trade-off of potential increased latency due to the involvement of the TURN server.</p><p>Simplified Explanation: Think of TURN servers as a post office or a messenger that helps deliver messages between two people who cannot directly reach each other. Imagine two friends trying to communicate, but there is a big wall between them. The TURN server acts as a mediator, receiving messages from one friend and delivering them to the other. This way, they can still exchange letters through the server even if they can&#39;t communicate directly.</p><p>In WebRTC, devices use STUN servers to find their public &quot;room numbers&quot; (IP addresses and ports) when they are hidden behind a router or firewall. This enables them to establish direct communication without relying on intermediate servers. But TURN servers come into play if the device cannot establish a direct connection due to network restrictions. They act as intermediaries, relaying communication between devices hidden behind firewalls or restrictive NAT configurations. While this ensures communication, it may introduce some additional delay.</p><h4>ICE ( Interactive Connectivity Establishment — ICE Candidate)</h4><p>as in the previous flow, we learned that Alise and Bob collect the ways others can connect; each way is known as ICE Candidate or ICE candidates are network addresses and transport protocols collected and exchanged during the WebRTC signaling process. Local candidates represent the device&#39;s private IP address and port within the local network. In contrast, server-reflexive candidates are obtained through STUN servers and represent the public IP address and port. ICE candidate prioritization: Devices evaluate and prioritize ICE candidates based on IP address type, transport protocol, and network conditions to choose the most suitable candidate pair for establishing a direct connection.</p><p>All collected addresses are then sent to the remote peer via the SDP ( Session Description Protocol ) standardized format used by WebRTC for exchanging session-related information between peers. SDP allows devices to negotiate the parameters of a communication session, such as audio and video codecs, network addresses, and transport protocols. Peers exchange SDP messages containing session descriptions, including their capabilities, preferences, and requirements, to establish compatibility and agree on the communication parameters.</p><pre>Alice:<br>v=0<br>o=- 2890844526 2890844526 IN IP4 192.168.0.101<br>s=-<br>t=0 0<br>a=group:BUNDLE audio video<br>m=audio 5004 RTP/SAVPF 111 103 104 9 0 8 106 105 13 126<br>c=IN IP4 192.168.0.101<br>a=rtpmap:111 opus/48000/2<br>a=rtpmap:103 ISAC/16000<br>a=rtpmap:104 ISAC/32000<br>a=rtpmap:9 G722/8000<br>a=rtpmap:0 PCMU/8000<br>a=rtpmap:8 PCMA/8000<br>a=rtpmap:106 CN/32000<br>a=rtpmap:105 CN/16000<br>a=rtpmap:13 CN/8000<br>a=rtpmap:126 telephone-event/8000<br>a=rtcp-mux<br>a=sendrecv</pre><pre>Bob:<br>v=0<br>o=- 2890844527 2890844527 IN IP4 192.168.0.102<br>s=-<br>t=0 0<br>a=group:BUNDLE audio video<br>m=audio 6004 RTP/SAVPF 111 103 104 9 0 8 106 105 13 126<br>c=IN IP4 192.168.0.102<br>a=rtpmap:111 opus/48000/2<br>a=rtpmap:103 ISAC/16000<br>a=rtpmap:104 ISAC/32000<br>a=rtpmap:9 G722/8000<br>a=rtpmap:0 PCMU/8000<br>a=rtpmap:8 PCMA/8000<br>a=rtpmap:106 CN/32000<br>a=rtpmap:105 CN/16000<br>a=rtpmap:13 CN/8000<br>a=rtpmap:126 telephone-event/8000<br>a=rtcp-mux<br>a=sendrecv</pre><p><em>( Explanation is not added if you want can comment down )</em></p><p><strong>Conclusion:</strong> STUN, TURN, ICE candidates, and SDP are fundamental components of WebRTC that enable seamless peer-to-peer communication.STUN assists in NAT traversal, TURN acts as a relay when direct connections are impossible, ICE candidates facilitate the optimal path selection, and SDP allows for negotiation and agreement on session parameters. Together, these technologies overcome the challenges posed by NAT, firewall restrictions, and compatibility issues, empowering WebRTC to deliver exceptional real-time communication experiences.</p><p>In the next blog, we will discuss the final flow and get started with the example, which you can test on your own to get a feel of how the whole architecture is designed.</p><p>Let’s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ac0eb8df2b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying WebRTC]]></title>
            <link>https://medium.com/@a.kanojiya2003/demystifying-webrtc-4f881229c648?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f881229c648</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nat]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[video-conferencing]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 17:29:17 GMT</pubDate>
            <atom:updated>2023-06-28T18:46:43.832Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*4bdLwWS43OVTlezA7qqhrQ.png" /></figure><blockquote>“An Overview of Real-Time Peer-to-Peer Communication”</blockquote><p>Welcome back to our exploration of WebRTC — the technology that empowers real-time peer-to-peer communication. In our previous blog, we introduced the transformative power of WebRTC and its role in revolutionizing video conferencing and chat applications. Today, we continue our journey as we dive deeper into the inner workings of WebRTC and unveil its incredible potential.</p><p>If you missed the previous blog, don&#39;t worry! We&#39;ll briefly recap the fundamental concepts before diving into more advanced aspects of WebRTC. Whether you&#39;re a developer seeking a comprehensive understanding of its flow and core concepts or an enthusiast eager to unravel the magic behind real-time connections, this blog series is your gateway to mastering WebRTC.</p><p>In the previous installment, we clarified the confusion surrounding WebRTC and WebSockets, highlighting their distinct purposes and use cases. Now, let&#39;s pick up where we left off and continue our exploration of WebRTC&#39;s inner workings.</p><h3>WebRTC Overview</h3><p>So, let&#39;s start getting an overview of WebRTC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uq2SFcs9G4v3P3iKMOcQcQ.png" /></figure><p>Let&#39;s start with a flow. Let&#39;s say there are two users, Alice and Bob both want to transmit data to each other using WebRTC. The flow begins with Alice initially. Alice tries to find out how someone can connect with him, same with Bob, who tries to find possible ways to communicate with him. Now they have methods for someone can relate to them. They will exchange session information through other means (e.g., WhatsApp, Twitter, QRcode, HTTP, WebSocket, …). Alice connects with Bob using the most optimal path. Alice and Bob exchange their supported media and security and are finally Connected.</p><p>The whole flow is the most basic flow of how WebRTC works. It contains many protocols and formats of exchange. We will take them out slowly by understanding every step.</p><h3>NAT ( Network Address Translation )</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooT8fF9mbbQv_iEzLKV3Og.png" /></figure><p>First, we have to understand the concept of NAT. It is a technology used in networking that allows multiple devices within a private network to share a single public IP address. NAT serves as a mediator between the devices within the private network and the external public network (such as the Internet).</p><p>The primary purpose of NAT is to conserve IPv4 addresses, as the available pool of public IP addresses is limited. Using NAT, organizations and households can connect multiple devices to the Internet without needing a unique public IP address for each device.</p><p><em>( I will add a more detailed blog on NAT if you can refer to that )</em></p><p>Previously, when there were no concepts of NAT (Network Address Translation) or other IP address hiding techniques, establishing direct connections between devices was simple. Users could quickly share their IP addresses, and connectivity was straightforward. However, with the advancement of networking technologies and the implementation of security measures, obtaining IP addresses for direct communication has become more complex.</p><p>In the next blog, we will discuss the Futhur about how WebRTC deals with NAT and what data is collected by each individual that has been transmitted so that they can connect.</p><p>Let’s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f881229c648" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Power of WebRTC]]></title>
            <link>https://medium.com/@a.kanojiya2003/unveiling-the-power-of-webrtc-b8d102040c71?source=rss-9ef93b00a2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8d102040c71</guid>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[videoconference]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[js]]></category>
            <dc:creator><![CDATA[Aman Kanojiya]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 09:33:14 GMT</pubDate>
            <atom:updated>2023-06-28T09:52:39.577Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*4bdLwWS43OVTlezA7qqhrQ.png" /></figure><blockquote><em>“Harnessing the Potential of Peer-to-Peer Communication for Video Conferencing and Chat Applications”</em></blockquote><p>Imagine a world where distance is no longer a barrier to seamless communication. Where video conferences feel like face-to-face interactions, and chat applications connect people in real time across the globe. This transformative power is made possible by WebRTC and peer-to-peer technology.</p><p>In today&#39;s fast-paced digital age, where remote work and virtual meetings have become the norm, understanding the inner workings of WebRTC and peer-to-peer communication is critical to unlocking the true potential of modern communication tools. These technologies have revolutionized how we connect, collaborate, and share experiences online.</p><p><strong><em>Main confusion (WebRTC and WebSockets)</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vaaemZ7fUXV3QmgHvj9V_A.png" /></figure><p>Some people need clarification on WebRTC and WebSockets as both web technologies are used for real-time communication. Still, they serve different purposes WebRTC enables direct peer-to-peer communication between browsers or applications, focusing on audio, video, and data transmission. On the other hand, WebSockets facilitate real-time bidirectional communication between a browser and a server. WebRTC is ideal for applications like video conferencing, while WebSockets are commonly used for real-time chat and data exchange with a server.</p><p>But how exactly do WebRTC and peer-to-peer technology work? How do they enable real-time video conferencing and chat applications? Join me on a journey as we dive into the fascinating world of WebRTC and explore the magic behind peer-to-peer communication.</p><p>In this series of blogs, we’ll unravel the complexities, demystify the technical jargon, and shed light on the practical applications of these game-changing technologies. Whether you’re a developer seeking to enhance your applications or simply curious about the technology driving the communication tools you use daily, this comprehensive guide will equip you with the needed knowledge.</p><p>So, let&#39;s understand this is brief …</p><h3>What is WebRTC?</h3><p>WebRTC, which stands for Web Real-Time Communication, is an open-source technology and set of protocols enabling real-time communication between web browsers or other applications. It provides a standardized audio, video, and data transmission framework, allowing users to communicate peer-to-peer without needing plugins or additional software installations.</p><p>WebRTC utilizes a combination of JavaScript APIs, HTML, and various communication protocols to establish secure and reliable connections between browsers. It leverages the principles of peer-to-peer communication, where data is transmitted directly between the participating devices (or peers) rather than routing it through a central server.</p><p><em>Critical components of WebRTC include:</em></p><ul><li><em>MediaStream: This API allows access to the user&#39;s camera and microphone, capturing audio and video streams that can be shared with other participants in real-time.</em></li><li><em>RTCPeerConnection: This API facilitates establishing a direct connection between peers, enabling secure transmission of audio, video, and data. It handles the negotiation of network capabilities, codecs, and security protocols.</em></li><li><em>RTCDataChannel: This API enables the exchange of arbitrary data between peers, supporting use cases beyond audio and video streaming. It allows applications to share real-time files, messages, or data.</em></li></ul><p>WebRTC is widely used for various applications, including video conferencing, voice calling, live streaming, online gaming, file sharing, and collaborative applications. It provides a flexible and standardized framework that empowers developers to create real-time communication experiences directly within web browsers and applications, enhancing user engagement and collaboration.</p><p>It&#39;s important to note that while WebRTC enables direct peer-to-peer communication, it still requires initial signaling and negotiation between peers, often facilitated through signaling servers or third-party services. These servers help establish the initial connection and exchange session information before direct peer-to-peer communication occurs.</p><p>In the next blog, we will discuss the overview and workflow of WebRTC.</p><p>Let&#39;s keep the conversation going! Follow me on social media to ask questions and continue learning. You can also leave your comments and questions below. Together, we can dive deeper into the world of WebRTC and explore its endless possibilities.</p><p><a href="https://www.instagram.com/aman_thecodeaddict/">Instagram </a>|| <a href="https://twitter.com/Aman_codeaddict">Twitter </a>|| <a href="https://github.com/AMANKANOJIYA">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8d102040c71" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>