<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kevin Guo</title>
    <description>The latest articles on DEV Community by Kevin Guo (@kevinguo).</description>
    <link>https://dev.to/kevinguo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F929190%2F8c397815-6145-45c4-bd30-3522b7b0ecda.jpeg</url>
      <title>DEV Community: Kevin Guo</title>
      <link>https://dev.to/kevinguo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kevinguo"/>
    <language>en</language>
    <item>
      <title>Socket.IO user study</title>
      <dc:creator>Kevin Guo</dc:creator>
      <pubDate>Mon, 28 Aug 2023 03:26:32 +0000</pubDate>
      <link>https://dev.to/azure/socketio-user-study-10bb</link>
      <guid>https://dev.to/azure/socketio-user-study-10bb</guid>
      <description>&lt;p&gt;Hello Socket.IO and real-time app developers,&lt;/p&gt;

&lt;p&gt;Since we put up an invitation to participate in a user study, we collected &lt;strong&gt;hundreds of responses&lt;/strong&gt; and had the chance to speak in depth with several Socket.IO users. Thank you for your interest in the user study and for helping us understand your experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feiqe5n7r7xfjb4cyvobf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feiqe5n7r7xfjb4cyvobf.png" alt="Screenshot of banner recruiting Socket.IO developers for user study" width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post, I am going to share with you some notable learnings from the study. It’s our hope that such sharing can shed light on how we can build a stronger community as Socket.IO users, contributors, and cloud providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Socket.IO is used in a wide range of app scenarios.
&lt;/h2&gt;

&lt;p&gt;We were pleasantly surprised by the variety of applications built using Socket.IO. Although a fair number of users reported building chat apps using Socket.IO, many shared that they use Socket.IO for identity management to limit the number of active browser tabs, for robotics to control the movement of mobile robots, for multi-player mobile games and for collaborative apps where users can track work items in real-time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overwhelmingly, users enjoy the “intuitive APIs”.
&lt;/h2&gt;

&lt;p&gt;Users seem to have exhausted the synonyms for “intuitive” in their responses. Once users have gone over the initial learning curve, it doesn’t take long before they can get productive with Socket.IO’s APIs, which are described as “simple”, “easy” and “plain”. Plains APIs are definitely a praise in this case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some users seem to have doubts about Socket.IO’s viability for large projects.
&lt;/h2&gt;

&lt;p&gt;Users new to Socket.IO seem to have the impression that Socket.IO is for small-scale and toy projects and it would be necessary to find alternatives when an app needs to scale. I am happy to report that the impression doesn’t reflect the reality; a few Socket.IO users shared that their apps handled 10s of thousands of concurrent connections well, powered by running multiple Socket.IO instances behind a load balancer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaling out a Socket.IO is where developers report the most pain.
&lt;/h2&gt;

&lt;p&gt;Scaling out a Socket.IO app requires a multi-server setup. Essentially, client connections are spread across several Socket.IO server instances. To emit an event to clients connected with different server instances, there needs to be a component to coordinate the message passing. While simple in broad-stroke description, implementation is not particularly straightforward or familiar to most users. Deploying and maintaining a separate adapter component adds additional complexity to the task.&lt;/p&gt;

&lt;p&gt;This is an area where we studied the most and thought we could bring the most value to developers. I am happy to share with you that with the input from the open-source community, we brought support for Socket.IO on Azure. With this support, Azure hosts and manages client connections; in other words, developers don’t need an “adapter” component.&lt;/p&gt;

&lt;p&gt;What’s more important is that server and client apps continue using &lt;strong&gt;the same and familiar Socket.IO APIs&lt;/strong&gt;. With only a few lines of code, you can get any socket.io apps running locally to Azure. You can learn more about the support and try it out for free by following the links below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/azure/azure-web-pubsub/socketio-overview"&gt;Overview of Socket.IO support on Azure&lt;/a&gt;&lt;br&gt;
&lt;a href="https://learn.microsoft.com/azure/azure-web-pubsub/socketio-quickstart"&gt;Quickstarts of hosting a Socket.IO app on Azure&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

</description>
      <category>socketio</category>
      <category>azure</category>
      <category>realtime</category>
    </item>
    <item>
      <title>Socket.IO on Azure</title>
      <dc:creator>Kevin Guo</dc:creator>
      <pubDate>Thu, 24 Aug 2023 03:36:09 +0000</pubDate>
      <link>https://dev.to/azure/socketio-on-azure-1ma</link>
      <guid>https://dev.to/azure/socketio-on-azure-1ma</guid>
      <description>&lt;h2&gt;
  
  
  Socket.IO powers a variety of real-time applications.
&lt;/h2&gt;

&lt;p&gt;We have been conducting user studies with Socket.IO users for the past few months and had the chance to meet the core maintainer of the open-source project. We were pleasantly surprised by the variety of applications built using Socket.IO, from identity management to robotics, not just chat apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaling out Socket.IO apps can be frustrating for developers.
&lt;/h2&gt;

&lt;p&gt;Overwhelmingly, users reported their love of the “intuitive APIs” and how easy it is to get productive with the library once they get over the initial learning curve. However, scaling out a Socket.IO app is where the most frustration and difficulty lie. Developers would much rather focus on building real-time experiences than developing and maintaining an “adapter” component like Redis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Host Soket.IO app on Azure for simplified architecture, scalability, and 99.9%+ uptime.
&lt;/h2&gt;

&lt;p&gt;With input from the open-source community, we brought support for Socket.IO on Azure. Socket.IO developers can continue using the familiar APIs they come to love from Socket.IO and let Azure handle scalability and availability. This means developers no longer need an “adapter” component. The Socket.IO server communicates with an Azure service and the Azure service fans out messages. The app architecture is simplified and more robust. See the diagram below. To see the full benefits of an Azure-managed Socket.IO app over a self-host approach, &lt;a href="https://learn.microsoft.com/azure/azure-web-pubsub/socketio-overview#benefits-over-hosting-socketio-app-yourself" rel="noopener noreferrer"&gt;read this article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2zklrw04kzl6nlyimujo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2zklrw04kzl6nlyimujo.jpg" alt="Architecture of how Socket.IO on Azure works"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Hosting a Socket.IO app to Azure takes only a few lines of code.
&lt;/h2&gt;

&lt;p&gt;Getting a Socket.IO app running locally to Azure requires only a few lines of code change. The following sections will walk you through how to host a simple chat app built with Socket.IO on Azure.&lt;/p&gt;

&lt;h3&gt;
  
  
  What you need
&lt;/h3&gt;

&lt;p&gt;To follow the steps, you will need&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An Azure account with an active subscription. If you don’t have one, you can create a free account.&lt;/li&gt;
&lt;li&gt;Some familiarity with the Socket.IO library.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Create a Socket.IO resource on Azure portal
&lt;/h3&gt;

&lt;p&gt;Head over to Azure portal and search for “socket.io”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8jyfy46uubxexodgogom.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8jyfy46uubxexodgogom.png" alt="Screenshot of creating Socket.IO resource on Azure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that the support for Socket.IO is provided through an Azure service called Web PubSub.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a Node project and install the required packages
&lt;/h3&gt;

&lt;p&gt;Note that beyond “socket.io-client” package, we also need “@azure/web-pubsub-socket.io”.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mkdir&lt;/span&gt; &lt;span class="nx"&gt;chatapp&lt;/span&gt;
&lt;span class="nx"&gt;cd&lt;/span&gt; &lt;span class="nx"&gt;chatapp&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;azure&lt;/span&gt;&lt;span class="sr"&gt;/web-pubsub-socket.io socket.io-clien&lt;/span&gt;&lt;span class="err"&gt;t
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Write server-side code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* server.js */&lt;/span&gt;
&lt;span class="c1"&gt;// Import required packages&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Server&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;socket.io&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useAzureSocketIO&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@azure/web-pubsub-socket.io&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Configure connection with the Azure service&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;wpsOptions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;hub&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;eio_hub&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// The hub name can be any valid string.&lt;/span&gt;
    &lt;span class="na"&gt;connectionString&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WebPubSubConnectionString&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Create a Socket.IO server supported by Azure&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;io&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Server&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;useAzureSocketIO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;io&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;wpsOptions&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Write message passing logic using Socket.IO's APIs.&lt;/span&gt;
&lt;span class="c1"&gt;// This code snippet is taken from Socket.IO's website and should be familiar to Socket.IO users.&lt;/span&gt;
&lt;span class="nx"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;connection&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Send a message to the client&lt;/span&gt;
    &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;world&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Receive a message from the client&lt;/span&gt;
    &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;howdy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;   &lt;span class="c1"&gt;// prints "stranger"&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Write client-side code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* client.js */&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;io&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;socket.io-client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;webPubSubEndpoint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;web-pubsub-socketio-endpoint&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;socket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;io&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;webPubSubEndpoint&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/clients/socketio/hubs/eio_hub&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Receives a message from the server&lt;/span&gt;
&lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Sends a message to the server&lt;/span&gt;
&lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;howdy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;stranger&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Run the app
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// Run server
node server.js &lt;span class="s2"&gt;"&amp;lt;web-pubsub-connection-string&amp;gt;"&lt;/span&gt;

// Run client
node client.js &lt;span class="s2"&gt;"&amp;lt;web-pubsub-endpoint&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Additional resources
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/azure/azure-web-pubsub/socketio-overview" rel="noopener noreferrer"&gt;Overview of Web PubSub for Socket.IO&lt;/a&gt;&lt;br&gt;
&lt;a href="https://learn.microsoft.com/azure/azure-web-pubsub/socketio-migrate-from-self-hosted" rel="noopener noreferrer"&gt;How to migrate a self-hosted Socket.IO to be fully managed on Azure&lt;/a&gt;&lt;/p&gt;

</description>
      <category>socketio</category>
      <category>azure</category>
    </item>
    <item>
      <title>What is WebSocket? (Part 2/2)</title>
      <dc:creator>Kevin Guo</dc:creator>
      <pubDate>Mon, 28 Nov 2022 02:19:49 +0000</pubDate>
      <link>https://dev.to/kevinguo/what-is-websocket-part-22-4ob9</link>
      <guid>https://dev.to/kevinguo/what-is-websocket-part-22-4ob9</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This article is the second of a two-part series that describes the values of WebSocket on a high-level.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;WebSocket gives developers a &lt;strong&gt;&lt;em&gt;bidirectional&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;full-duplex&lt;/em&gt;&lt;/strong&gt; communication channels over HTTP through a single TCP connection &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Full-duplex&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To put it simply, “full-duplex” means that data can be transmitted at the same time in both directions. Like “bidirectional” we just talked about, full-duplex is also about two things, two entities, but full-duplex is more about the &lt;strong&gt;TIMING&lt;/strong&gt; of sending data. &lt;/p&gt;

&lt;p&gt;A phone call is considered full-duplex because both the caller and the receiver can send voice data to each other at the same time. &lt;/p&gt;

&lt;p&gt;A walkie-talkie is considered half-duplex because at one time only one person can send voice data. The participants take turns to speak. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5Wg3dl9E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4xwutchm5esbklsfzyf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5Wg3dl9E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4xwutchm5esbklsfzyf.jpg" alt="Picture of a walkie-talkie" width="500" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The web before WebSocket was largely half-duplex. The client opens a communication channel and requests a resource through this channel from a remote server. It waits for the server to return the requested resource. While the client waits, it cannot send data through the same channel. Also, while the server is sending data, the client cannot request resource through the same channel, much like how we communicate with a walkie-talkie. &lt;/p&gt;

&lt;p&gt;Imagine if you are talking with your grandma using a walkie-talkie and you ask “Grandma, what’s like when you were growing up in the countryside?” Grandma presses the “Talk button” and she starts from the Great Depression, World War 1 and on with World War 2… While grandma paints the scene of her storied life, teasing grandma by completing the stories for her is not an option. Your only option? Listen on. (No grandmas were hurt in telling this joke.) &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--otip-alo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9qngo9cac5ej1moue0m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--otip-alo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9qngo9cac5ej1moue0m.jpg" alt="Picture of a grandma and her granddaughter" width="703" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The walkie-talkie style of the early web was fine when communication was largely infrequent requests for resources from client to server. For web applications with interactive experience, like a collaborative document or a collaborative design application, users could be making changes at the same time and to have a smooth real-time editing experience, the changes need to be reflected on users’ screens as soon as they are made. The trusty HTTP protocol, being an inherently half-duplex communication model, cannot meet the new requirements without resorting to some workarounds. Hacks no more! WebSocket brings native full-duplex communication to the web.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;To conclude&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;“Bidirectional” and “full-duplex” are the two value propositions WebSocket offers to developers and it has enabled a myriad of new interesting experience on the web, multi-player gaming, online auction, real-time collaborative apps and online chatting, to name a few. And the best of it all, it does not take much to add these real-time capabilities to your applications. &lt;/p&gt;

&lt;p&gt;Explore a few live apps built with 🔗 &lt;strong&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/azure-web-pubsub/overview"&gt;Azure Web PubSub&lt;/a&gt;&lt;/strong&gt;, a fully managed WebSocket service from Azure.  &lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://azure.github.io/azure-webpubsub/demos/chat"&gt;A simple chat app&lt;/a&gt;&lt;br&gt;
🔗 &lt;a href="https://azure.github.io/azure-webpubsub/demos/whiteboard"&gt;A collaborative whiteboard app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tidl-ZSw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8huklbrtkea20vkpahlp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tidl-ZSw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8huklbrtkea20vkpahlp.jpg" alt="Some scenarios that can be enabled by WebSocket" width="880" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Credits:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The walkie-talkie and the grandma photographs were taken by 🔗 &lt;a href="https://www.pexels.com/@cottonbro/"&gt;cottonbro studio&lt;/a&gt;.  &lt;/p&gt;

</description>
      <category>websocke</category>
      <category>azure</category>
    </item>
    <item>
      <title>What is WebSocket? (Part 1/2)</title>
      <dc:creator>Kevin Guo</dc:creator>
      <pubDate>Mon, 14 Nov 2022 07:25:13 +0000</pubDate>
      <link>https://dev.to/kevinguo/what-is-websocket-part-12-j69</link>
      <guid>https://dev.to/kevinguo/what-is-websocket-part-12-j69</guid>
      <description>&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;This article is the first of a two-part series that describes the values of WebSocket on a high-level. &lt;/p&gt;

&lt;h2&gt;
  
  
  Quick links
&lt;/h2&gt;

&lt;p&gt;Explore a few live apps built with &lt;a href="https://learn.microsoft.com/en-us/azure/azure-web-pubsub/overview"&gt;Web PubSub&lt;/a&gt;, a fully managed WebSocket service from Azure.&lt;br&gt;
&lt;a href="https://azure.github.io/azure-webpubsub/demos/chat"&gt;A simple chat app&lt;/a&gt;&lt;br&gt;
&lt;a href="https://azure.github.io/azure-webpubsub/demos/whiteboard"&gt;A collaborative whiteboard app&lt;/a&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt;&lt;br&gt;
WebSocket gives developers a &lt;strong&gt;&lt;em&gt;bidirectional&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;full-duplex&lt;/em&gt;&lt;/strong&gt; communication channels over HTTP through a single TCP connection. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let us unpack this loaded sentence together and try to understand the italicized words (technical jargon). &lt;/p&gt;

&lt;h3&gt;
  
  
  Bidirectional
&lt;/h3&gt;

&lt;p&gt;The prefix “bi-“ means two of something. We have bicycles, two wheels. We have bifold doors, the fancy doors with two folds. In the context of computer networking, no surprise here, bidirectional means two directions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IMqrudgY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/76av6ydhg5ejpaih2ll8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IMqrudgY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/76av6ydhg5ejpaih2ll8.jpg" alt="Picture of a bicycle, bi-fold doors and bi-directional communication in computer networking" width="407" height="1022"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, to truly understand the significance of it, we will need to talk about the interaction between applications running on different computers on a network.  In a typical client and server model, the client sends an HTTP request. Once the server receives the request, it does some processing and returns an HTTP response. Most of the activities on the web can be simplified to this request and response interaction. For example, when we visit &lt;a href="https://www.nytimes.com/"&gt;www.nytimes.com&lt;/a&gt;, the browser sends an HTTP request on the user’s behalf and waits for an HTTP response from its server.&lt;/p&gt;

&lt;p&gt;What is relevant to our discussion here is that the client &lt;strong&gt;ALWAYS&lt;/strong&gt; initiates the communication, in other words, the client always &lt;em&gt;asks&lt;/em&gt; before the server &lt;em&gt;responds&lt;/em&gt;. We can call this form of communication one-directional because the server cannot send data to clients that is not requested. This is the decision made by the designer of HTTP protocol, and this simple design is the technological backbone of the internet. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PZfvu-JL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84fwu5nsdfdpxsnmdgwi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PZfvu-JL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84fwu5nsdfdpxsnmdgwi.jpg" alt="Client makes request and server responds." width="813" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As the web welcomes more and more users, they are increasingly demanding more dynamic and interactive web experience. They want to track their ridesharing car without closing and reopening the app; they want to see the latest financial data, bid in an auction, collaborate on a document all without refreshing the browser all the time. A one-directional communication becomes inadequate in these scenarios. To enable these experiences, the web needs a way for server to send data to clients without client asking. Until WebSocket was standardized in 2008 and quickly supported by modern browsers, the web was unapologetically one-directional. With a bit of uneasiness and feeling cheating, software developers came up with workarounds to mimic bidirectional communication. Hacks no more! WebSocket brings native bi-directional communication to the web.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OOyBv8R---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4te6bvk24l23cdt75hdh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OOyBv8R---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4te6bvk24l23cdt75hdh.jpg" alt="WebSocket enables bi-directional communication" width="813" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the second part, we will explore the idea of “full-duplex”.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Credits:&lt;/strong&gt;&lt;br&gt;
GitHub&lt;a href="https://github.com/JialinXin"&gt;@JialinXin&lt;/a&gt; Thank you for reviewing the article.&lt;br&gt;
The bicycle photograph is taken by &lt;a href="https://www.pexels.com/@luftschnitzel/"&gt;Philipp M&lt;/a&gt;.&lt;br&gt;
The bi-fold door photograph is taken by &lt;a href="https://www.pexels.com/@sena-124356903/"&gt;sena&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>websocket</category>
      <category>azure</category>
    </item>
  </channel>
</rss>
