<?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 Luis Aviles on Medium]]></title>
        <description><![CDATA[Stories by Luis Aviles on Medium]]></description>
        <link>https://medium.com/@luixaviles?source=rss-b529714282d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MABXAaQ0_9RXVVQgut8NYw.jpeg</url>
            <title>Stories by Luis Aviles on Medium</title>
            <link>https://medium.com/@luixaviles?source=rss-b529714282d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 17:01:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@luixaviles/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[Build Your First Voice-Driven Web Application]]></title>
            <link>https://medium.com/@luixaviles/build-your-first-voice-driven-web-application-84709e806359?source=rss-b529714282d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/84709e806359</guid>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[voice-recognition]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Luis Aviles]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 13:37:19 GMT</pubDate>
            <atom:updated>2020-07-21T13:37:19.155Z</atom:updated>
            <content:encoded><![CDATA[<h4>Talk to your web app and allow it to respond to you</h4><p>Some time ago I had the goal to implement a web application to be able to write what I’m speaking automatically and allow to execute actions through my voice commands. I thought it was a good idea to provide a way to listen to some feedback from the application too. After doing quick research I discovered a couple of Web APIs to solve this problem.</p><p>In this post, I will explain how you can use modern Web APIs to add the nice capability to speak to your web application and allow it to respond to you. We will implement the app from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nIhVuqoa5LEM2DEt.jpg" /></figure><h3>What is an API?</h3><p>API is the acronym for <em>Application Programming Interface</em>. According to <a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction">MDN</a> website:</p><blockquote><em>APIs are constructs made available in programming languages to allow developers to create complex functionality more easily.</em></blockquote><p>In simple words, APIs provide a <em>way</em> to create complex applications without having to learn or implement the details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SQPuhvPhbPCSwZ6p.png" /><figcaption>API Diagram — Camera example</figcaption></figure><p>Let’s describe an example, you just bought a camera and you only need to press buttons to <em>turn-on</em>, <em>turn-off</em>, <em>activate the Bluetooth</em>, and <em>start recording</em>. As you can see, we’re talking about a device that has a complex circuit that involves sensors, lenses, power management, and other details. You don’t need to work through these wiring or manage the circuit itself.</p><h3>Web APIs</h3><p>Have you ever used <em>fetch</em> or a <em>Service Worker</em>? Maybe you used or accessed the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model">DOM</a> from JavaScript?</p><p>Well, you can accomplish complex tasks based on those features since they are part of an extensive list of <a href="https://developer.mozilla.org/en-US/docs/Web/API">Web APIs</a>. These APIs are not part of JavaScript, however, you can use them through this programming language(or any other JavaScript-based library/framework).</p><p>On the other hand, you may need to make sure a Web API is fully supported by your web browser before to start building an application based on it. For example, if you are planning to work with <em>fetch</em>, you can see what browsers or JavaScript engines <a href="https://caniuse.com/#search=fetch">support it</a>.</p><h3>The Web Speech API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2nQj5DoNPxbE25h6.png" /></figure><p>As you can see in the previous image, this Web API can help you with the following:</p><ul><li>Generate speech-to-text output</li><li>Uses speech recognition as input</li><li>Supports continuous dictation(You can write a complete letter)</li><li>Control interface for web browsers</li></ul><p>For more details, please see the <a href="https://wicg.github.io/speech-api/">Web Speech API</a> specification.</p><h3>The SpeechSynthesis Interface</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sORzaNxuZ4VlJ2VZ.png" /></figure><p>You got the idea with the above image. The <em>Web Speech Synthesis</em> interface can generate a text-to-speech output.</p><p>Please refer to the <a href="https://wicg.github.io/speech-api/#tts-section">specification</a> to learn more about this interface.</p><h3>Watch The Video</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FPIbMsHciovQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPIbMsHciovQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FPIbMsHciovQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9770ff080b66bfb31d42dda3d9a6196/href">https://medium.com/media/e9770ff080b66bfb31d42dda3d9a6196/href</a></iframe><h3>Implement the Web Application</h3><p>The application will be based on HTML, CSS, and TypeScript as the programming language. We’ll use the latest Angular version through Angular Material components. Also, We will define a <em>reactive programming</em> approach using <em>Observables</em> and the <em>AsyncPipe</em> from Angular. Finally, we will provide a <em>Strategy pattern</em> implementation among other features.</p><p>Read the full story, try the live demo and access to the source code here: <a href="https://luixaviles.com/2020/07/build-your-first-voice-driven-web-app/">https://luixaviles.com/2020/07/build-your-first-voice-driven-web-app/</a></p><p><em>Originally published at </em><a href="https://luixaviles.com/2020/07/build-your-first-voice-driven-web-app/"><em>https://luixaviles.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84709e806359" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[!Angular 9 está aquí!]]></title>
            <link>https://medium.com/@luixaviles/angular-9-est%C3%A1-aqu%C3%AD-18996c222212?source=rss-b529714282d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/18996c222212</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Luis Aviles]]></dc:creator>
            <pubDate>Fri, 07 Feb 2020 00:38:27 GMT</pubDate>
            <atom:updated>2020-02-07T19:44:46.563Z</atom:updated>
            <content:encoded><![CDATA[<h3>¡Angular 9 está aquí!</h3><p>Más ligero, rápido, simple y compatible hacia atrás</p><p>La versión 9.0.0 de Angular finalmente ha visto la luz. Este lanzamiento se convierte en algo muy importante para el ecosistema Angular, ya que abarca toda la plataforma, incluyendo el <em>framework</em>, Angular Material y Angular CLI. Esta versión hace uso de Angular Ivy por defecto e introduce mecanismos mejorados para probar componentes.</p><p>El lanzamiento de esta nueva versión se convierte en una de las actualizaciones más importantes en los últimos 3 años.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gnLu9b3bymvMwW5uvDlikg.png" /></figure><h3>¿Cómo Actualizar a la versión 9?</h3><p>Para tener una mejor experiencia, se recomienda actualizar primero a Angular 8.</p><pre>ng update @angular/cli@8 @angular/core@8</pre><p>Luego, actualiza a la versión 9</p><pre>ng update @angular/cli @angular/core</pre><p>Visita <a href="http://update.angular.io/">update.angular.io</a> para encontrar información detallada sobre el proceso de actualización.</p><h3>Angular Ivy</h3><p>La versión 9 mueve todas las aplicaciones para usar el motor de compilación-ejecución denominado “Ivy”. Este motor reemplaza el anteriormente conocido como “View Engine”.</p><p>Este cambio es transparente para los desarrolladores y además ofrece numerosas ventajas:</p><ul><li>Tamaños en los <em>bundles</em> más reducidos</li><li>Pruebas más rápidas</li><li>Mejor mecanismo de depuración(<em>debugging</em>)</li><li>Un mejorado <em>binding</em> CSS por <em>class</em> y <em>style</em></li><li>Validación de tipos mejorada</li><li>Errores en compilación mejorados</li><li>Tiempos de compilación mejorados, que habilitan AOT(<em>Ahead of Time</em>) por defecto</li><li>Internacionalización mejorada</li></ul><h3>Otras mejoras en la versión 9</h3><p>El equipo Angular también ha estado trabajando para mejorar la experiencia completa de desarrollo.</p><h3>Actualizaciones más confiables</h3><p>Se han realizado cambios en el funcionamiento deng update para que sea más confiable e informativo.</p><ul><li><strong>Usa siempre la última versión de CLI.</strong> Empezando con la versión 8.3.19 de Angular CLI, ahora usa el CLI de la versión de actualización TARGET durante el proceso de actualización. Esto significa que las actualizaciones serán manejadas por la última versión de CLI automáticamente.</li><li><strong>Progreso de actualización más claro.</strong> ng update ahora hace más para decirte lo que sucede en el fondo.</li><li><strong>Depuración de actualizaciones más simple.</strong> De forma predeterminada, ng update ejecuta todas las migraciones y deja los cambios adicionales visibles en disco, para que puedas revisarlos. Con la versión 9 también se introduce el parámetro --create-commits . Cuando ejecutas ng update --create-commits , la herramienta confirma el estado del código después de cada migración, para que se pueda entender o depurar cada uno de los cambios que se están produciendo en tu código.</li></ul><h3>Nuevas opciones para &#39;providedIn&#39;</h3><p>Cuando creas un servicio como @Injectable en Angular, se debe elegir dónde agregar al inyector. Además de las opciones actuales root y módulo, se tienen las siguientes:</p><ul><li>platform — Especificando provideIn: &#39;platform&#39; hace que el servicio esté disponible en un inyector de plataforma <em>singleton</em>, el cual es compartido por todas las aplicaciones en la página.</li><li>any — Provee una instancia única en cada módulo(incluyendo en módulos diferidos, <em>lazy modules</em>) que inyectan el token.</li></ul><p>Vea <a href="https://angular.io/api/core/Injectable">más información sobre provideIn</a> en la documentación oficial.</p><h3>Nuevos componentes</h3><p>Ahora se pueden agregar el soporte de YouTube y Google Maps en tus aplicaciones.</p><h4>Componente YouTube</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*WLl3vOu-tPQ0yol9CcYaqw.png" /></figure><p>Ahora es posible renderizar un reproductor de YouTube en línea dentro de tu aplicación con el nuevo youtube-player.</p><p>Para agregar este componente, debes instalarlo:</p><pre>npm install @angular/youtube-player</pre><p>Este componente provee un componente <em>wrapper</em> que simplifica el uso de <a href="https://developers.google.com/youtube/iframe_api_reference">YouTube player API.</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4302231d650aecfca25cb7c995cb71a1/href">https://medium.com/media/4302231d650aecfca25cb7c995cb71a1/href</a></iframe><h4>Componente Google Maps</h4><p>También se presentan componentes google-maps, los cuales tienen por objeto facilitar la renderización de mapas, marcadores, y conectar la interactividad como si fuera un componente Angular convencional, lo cual evita tener que aprender el API de Google Maps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*45ozXgrfvKaK7D_sfuWJWQ.jpeg" /></figure><p>Este nuevo componente implementa el denominado <a href="https://developers.google.com/maps/documentation/javascript/tutorial">Maps JavaScript API</a></p><p>Para agregar este soporte, debes instalar:</p><pre>npm install @angular/google-maps</pre><p>De esta forma, podremos renderizar un mapa con unas cuantas líneas de código</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f9949c0e1fcdfe7b79b16b85cd33412/href">https://medium.com/media/6f9949c0e1fcdfe7b79b16b85cd33412/href</a></iframe><h3>IDE y mejoras con language service</h3><p>Se han realizado mejoras significativas en la extensión <a href="https://marketplace.visualstudio.com/items?itemName=Angular.ng-template"><em>Angular language service</em></a>(disponible en el Visual Studio Marketplace). Junto con una importante revisión de arquitectura para abordar problemas de rendimiento y estabilidad, también se han solucionado errores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*jPuFF0EAPv8wernAVQ39FA.gif" /></figure><h3>Soporte de TypeScript 3.7</h3><p>Angular se ha actualizado para que use TypeScript 3.6 y 3.7, incluyendo el extremadamente popular <em>optional chaining</em> de TypeScript 3.7</p><pre><strong>let</strong> x = foo?.bar.baz();</pre><p>Que llega a ser una versión más legible y simplificada del siguiente código:</p><pre><strong>let</strong> x = (foo === null || foo === undefined) ? undefined :     foo.bar.baz();</pre><p>También se han actualizado las versiones para otras dependencias del ecosistema, como Zone.JS y RxJS.</p><h3>Agradecimientos</h3><p>El lanzamiento de la versión estable de Angular 9 supone la culminación exitosa demás de 2 años de trabajo. Las posibilidades que ofrecen estos cambios llenan de entusiasmo a la comunidad y no habría sido posible sin el aporte de cientos de personas que forman parte de la misma, además de un equipo increíble que lidera el rumbo de nuestro <em>framework</em> favorito.</p><p>Para conocer más sobre el lanzamiento de esta nueva versión, puedes visitar <a href="https://blog.angular.io/version-9-of-angular-now-available-project-ivy-has-arrived-23c97b63cfa3">la historia el blog oficial de Angular.</a></p><p><strong>Nota.</strong> Este post es una traducción parcial del post “<a href="https://blog.angular.io/version-9-of-angular-now-available-project-ivy-has-arrived-23c97b63cfa3">https://blog.angular.io/version-9-of-angular-now-available-project-ivy-has-arrived-23c97b63cfa3</a>” escrito por <a href="https://medium.com/u/a1fba6cea10f">Stephen Fluin</a>, miembro del Equipo Angular.<br>Si te gustaron las novedades en torno a Angular 9, <a href="https://angular.io/about">conoce al equipo</a> que contribuye con su desarrollo y síguelos en sus redes.</p><p>Si te gustó el post, compártelo con tus amigos y dale un aplauso 👏🏼</p><p>Puedes seguirme en <a href="https://twitter.com/luixaviles"><strong>Twitter</strong></a> y <a href="https://github.com/luixaviles"><strong>GitHub</strong></a> para conocer más de mi trabajo.</p><p>¡Gracias por leer!<br> — Luis Aviles</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18996c222212" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real Time Apps with TypeScript: Integrating Web Sockets, Node & Angular]]></title>
            <link>https://medium.com/dailyjs/real-time-apps-with-typescript-integrating-web-sockets-node-angular-e2b57cbd1ec1?source=rss-b529714282d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2b57cbd1ec1</guid>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Luis Aviles]]></dc:creator>
            <pubDate>Tue, 09 Jan 2018 14:32:12 GMT</pubDate>
            <atom:updated>2018-01-24T19:17:54.827Z</atom:updated>
            <content:encoded><![CDATA[<h4>Building a Real Time Chat app from scratch using TypeScript</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*4877k4Hq9dPdtmvg9hnGFA.jpeg" /></figure><p>Some time ago I implemented a simple chat application using TypeScript language only. The main goal was to write a demo to explain how you can use this programming language on the client side and on the server. The client app is using latest Angular features.</p><p>In this post I will show you how I implemented the app from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*EMdtWtlIp0elKgWhtqxUwg.gif" /><figcaption>Demo: TypeScript Chat Application</figcaption></figure><h4>What is a Real Time Application?</h4><p>According this <a href="https://en.wikipedia.org/wiki/Real-time_web">Wikipedia definition</a>, a real-time application allows information to be received <strong>as soon as it is published</strong>, rather than requiring a source to be checked periodically for updates. Therefore, this kind of app should give a feeling to users that events and actions happen immediately.</p><h4>WebSockets</h4><p>WebSockets is a protocol that provides a bi-directional communication channel. This means that a browser and web server can maintain real-time comms, sending messages back and forth while the connection is open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HDEuF54yWrJdnwvLaWIWg.png" /><figcaption>Websockets communication</figcaption></figure><h4><strong>Application Structure</strong></h4><p>We will separate server related code and client code. I will go into details when most important files will are explained. For now, this is the expected structure of our application:</p><pre>server/<br>|- src/<br>|- package.json<br>|- tsconfig.json<br>|- gulpfile.js</pre><pre>client/<br>|- src/<br>|- package.json<br>|- tsconfig.json<br>|- .angular-cli.json</pre><h3>Server Code</h3><p>Since WebSockets is a <a href="https://tools.ietf.org/html/rfc6455">specification</a>, we can find <a href="https://github.com/facundofarias/awesome-websockets">several implementations</a> about it. We can choose J̶a̶v̶a̶S̶c̶r̶i̶p̶t̶ TypeScript or any other programming language.</p><p>In this case we’ll use <a href="http://socket.io/">Socket.IO</a>, which is one of the fastest and most reliable real-time engines.</p><h4>Why use TypeScript on server side code?</h4><p>TypeScript comes with really cool <a href="https://www.typescriptlang.org/">features </a>and it is updated very often. It <a href="http://ttendency.cs.ucl.ac.uk/projects/type_study/documents/type_study.pdf">can prevent about 15% of bugs</a>. Do you need more reasons? 😄</p><h4>Initializing server application</h4><p><a href="https://docs.npmjs.com/cli/init">Create a </a><a href="https://docs.npmjs.com/cli/init">package.json</a> file and then install the following dependencies:</p><pre>npm install --save express socket.io @types/express @types/socket.io</pre><p>We’ll need to install some devDependencies to allow integrate gulp and typescript so that we can define build tasks easily with these tools later:</p><pre>npm install --save-dev typescript gulp gulp-typescript</pre><h4>TypeScript Compiler Configuration</h4><p>Create a tsconfig.json file with the following content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/92694871ac46b36406c83add47b2f711/href">https://medium.com/media/92694871ac46b36406c83add47b2f711/href</a></iframe><h4>Data Model definition</h4><p>Taking advantage of static typing, let’s define a small data model as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30e4196bf17be8e1c958105b1b1522ed/href">https://medium.com/media/30e4196bf17be8e1c958105b1b1522ed/href</a></iframe><p>..let’s see further details into our server/src directory:</p><pre>server/<br>|- src/<br>   |- model/<br>      |- message.model.ts<br>      |- user.model.ts<br>   |- index.ts<br>   |- server.ts<br>|- package.json<br>|- tsconfig.json<br>|- gulpfile.js</pre><h4>Chat Server Implementation</h4><p>The main files in server directory are index.ts and chat-server.ts. The first one allows us to create and export our ChatServer app, while the last one contains <a href="https://expressjs.com/">express</a> and <a href="https://socket.io/">socket.IO</a> configurations:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c73f6847b757123db32ec90115a1a73b/href">https://medium.com/media/c73f6847b757123db32ec90115a1a73b/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6498c4b94514dd9dd9e81c67e88d5d88/href">https://medium.com/media/6498c4b94514dd9dd9e81c67e88d5d88/href</a></iframe><h4>Server Classes</h4><p>The previous code will give a result of the following classes and relationships:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*-FNkJxTH5kDiBPdJx4tVIg.png" /><figcaption>Server classes diagram</figcaption></figure><h4>Build and Run the Server</h4><p>In order to have JavaScript files needed by the V8 engine of Node.js, we can add a build task into our gulpfile.js file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/189694b7cb029c03229a720597afc176/href">https://medium.com/media/189694b7cb029c03229a720597afc176/href</a></iframe><p>As you can see, the output of build process(JavaScript files) will be located indist directory. To perform this action, you’ll need to run:</p><pre>gulp build</pre><p>Now we can run node dist/index.js command to have the server running.</p><h3>Client Code</h3><p>Let’s generate our client directory using the latest <a href="https://cli.angular.io/">Angular CLI</a> version:</p><pre>ng new typescript-chat-client --routing --prefix tcc --skip-install</pre><p>Then install your dependencies running npm install<em>(I prefer to use </em><a href="https://yarnpkg.com/en/"><em>Yarn</em></a><em> for this step)</em>:</p><pre>cd typescript-chat-client<br>yarn install</pre><h4><strong>Adding Angular Material</strong></h4><p>Find and follow the latest guide to install <a href="https://material.angular.io/guide/getting-started">Angular Material</a> inside your Angular CLI project.</p><p>As part of using best practices in our <a href="https://angular.io/guide/styleguide#application-structure-and-ngmodules">project structure</a>, we can create shared and materialmodules:</p><pre>client/<br>|- src/<br>   |- app/<br>      |- chat/<br>      <strong>|- shared/<br>         |- material/<br>            |- material.module.ts<br>         |- shared.module.ts</strong><br>      |-app.module.ts</pre><p>We can do that from the command line interface:</p><pre>ng generate module shared --module app<br>ng generate module shared/material --module shared</pre><p>Check the changes inside app.module.ts and shared.module.ts to see the relationships created between these modules.</p><h4>Adding express and socket.IO</h4><p>We’ll need to add express and socket.io modules into our client App:</p><pre>npm install express socket.io --save</pre><h4>Chat Modules and Components</h4><p>Let’s create a new module before starting to create components for our chat application:</p><pre>ng generate module chat --module app</pre><p>Now add a component into newest module:</p><pre>ng generate component chat --module chat</pre><p>In order to use web-sockets and custom models, let’s create another shared folder. This time inside chat directory:</p><pre>ng generate service chat/shared/services/socket --module chat<br>ng generate class chat/shared/model/user<br>ng generate class chat/shared/model/message</pre><p>We’ll be ending with a structure similar to:</p><pre>client/<br>|- src/<br>   |- app/<br>      |- chat/<br>         <strong>|- shared/<br>           |- model/<br>              |- user.ts<br>              |- message.ts<br>           |- services/<br>              |- socket.service.ts</strong><br>      |- shared/<br>      |-app.module.ts</pre><h4>Observables and Web Sockets</h4><p>Since our Angular app comes with RxJS, we can use Observables to catch Socket.IO events:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/07008192728119dc6bdf9768b7a426cc/href">https://medium.com/media/07008192728119dc6bdf9768b7a426cc/href</a></iframe><p>We’ll need to define some <em>enums </em>to manage Actions and Events in the App:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91af7bc0b288946efd0dbbaada30a724/href">https://medium.com/media/91af7bc0b288946efd0dbbaada30a724/href</a></iframe><p>Now we’re ready to <em>listen</em> to messages from the server:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45dcb0ec661c0eaad664102f0689d63a/href">https://medium.com/media/45dcb0ec661c0eaad664102f0689d63a/href</a></iframe><p>Once ChatComponent gets initialized, the component is going to <em>subscribe</em> to SocketService observables in order to start to receive connection events or incoming messages.</p><p>The sendMessage and sendNotification functions are going to send the respective content through the same service. Notifications sent at this time are <em>Rename User</em> and <em>User Joined.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*4877k4Hq9dPdtmvg9hnGFA.jpeg" /></figure><h4>Chat Application features</h4><ul><li>Angular CLI</li><li>Angular 5</li><li>Angular Material</li><li>Validation Forms</li></ul><h4>Source Code</h4><p>Find the complete project in this GitHub repository:</p><blockquote><a href="https://github.com/luixaviles/socket-io-typescript-chat"><em>github.com/luixaviles/socket-io-typescript-chat</em></a></blockquote><h4>Live Demo</h4><p>Go through to <a href="https://typescript-chat.firebaseapp.com/">typescript-chat.firebaseapp.com</a> and open two or more tabs in your favorite browser and start a conversation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZrJKJqBsksWd-8uKM9OvgA.png" /></figure><p>If you liked this post, be sure to share it with your friends or give it a clap. 👏</p><p>You can follow me on <a href="https://twitter.com/luixaviles"><strong>Twitter</strong></a> and <a href="https://github.com/luixaviles"><strong>GitHub</strong></a> to see more about my work.</p><p>Thank you for reading!<br>— <a href="https://medium.com/u/b529714282d9">Luis Aviles</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2b57cbd1ec1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dailyjs/real-time-apps-with-typescript-integrating-web-sockets-node-angular-e2b57cbd1ec1">Real Time Apps with TypeScript: Integrating Web Sockets, Node &amp; Angular</a> was originally published in <a href="https://medium.com/dailyjs">DailyJS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up Local Environment to Develop Angular Applications]]></title>
            <link>https://medium.com/@luixaviles/setting-up-local-environment-to-develop-angular-applications-ccf3c8d61d6?source=rss-b529714282d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccf3c8d61d6</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[guides-and-tutorials]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Luis Aviles]]></dc:creator>
            <pubDate>Fri, 04 Aug 2017 00:00:00 GMT</pubDate>
            <atom:updated>2019-01-17T20:04:30.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NACus9WrUGcxW2cgxAxBTA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/IKUYGCFmfw4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Blake Connally</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Getting Ready to start with Angular</h4><p>Angular is definitely in a great stage and every new version comes with awesome features. The <a href="https://github.com/angular">project</a> itself comes with great tools that will allow you to start to develop web applications from scratch.</p><p>A common question, from the people that I know, is about the tools they need in their environments before starting to develop with the framework, and that’s why I decided to write this post.</p><p>From my point of view, you’ll need to install the following tools in your local environment.</p><h3>Git</h3><p>According <a href="https://www.sbf5.com/~cduan/technical/git/git-1.shtml"><em>Understanding Git</em></a>:</p><blockquote>The <strong>purpose of Git</strong> is to manage a project, or a set of files, as they change over time. <strong>Git</strong> stores this information in a data structure called a repository.</blockquote><p>Find and download latest version of this version control system <a href="https://git-scm.com/downloads">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*hCm3p7ngAMhLP_R8.png" /><figcaption>Photo by <a href="https://medium.com/@haydar_ai/learning-how-to-git-creating-your-first-commit-c753ed2e7498">Learning How to Git: Creating Your First Commit</a></figcaption></figure><h3>NVM(Node Version Manager)</h3><p>A recommendation is to use the latest LTS version, especially in production environments. However, instead of having Node installed directly on your system, I suggest to install it through NVM.</p><ul><li>macOS or GNU/Linux users, take a look <a href="https://github.com/creationix/nvm">here</a>.</li><li>Windows users, take a look <a href="https://github.com/coreybutler/nvm-windows">here</a>.</li></ul><p>NVM is a great tool that will allow you to manage multiple Node versions in your local environment. You can move forward with it even for Node projects.</p><p>Once you have installed NVM, you should be able to see its version using following command:</p><pre>nvm --version</pre><p>If the command result shows any error message, please take a look on registered GitHub issues for your NVM choice.</p><p>If you still have problems running nvm in your environment, you can move forward and <a href="https://nodejs.org/en/download/">download Node installer</a> and continue with next steps.</p><h3>Installing Node, using NVM</h3><h4>macOS and GNU/Linux users</h4><p>Just type the following commands:</p><pre>nvm install --lts <br>nvm use --lts <br>node --version</pre><h4>Windows users</h4><p>You’ll have to take a look on the <a href="https://nodejs.org/en/">Node.js website</a> to know the version number of latest <em>LTS</em>. After that, you can install it using the following command:</p><pre>nvm install 10.15.0 <br>nvm use 10.15.0<br>node --version</pre><h3>Yarn</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*0RbM6qp3o6utjfCW.png" /></figure><p><a href="https://yarnpkg.com/">Yarn</a> defines itself as a <em>fast, reliable and secure dependency management tool</em>(and I believe them). That’s why I prefer to use this awesome tool to manage node modules into Angular projects.</p><p>Your can find the steps to install Yarn on your platform <a href="https://yarnpkg.com/en/docs/install">here</a>.</p><p>If you have any problem with the installation process you can try to move on with this command:</p><pre>npm install -g yarn</pre><p>Whatever method you used to install Yarn, you should be able to verify it by doing:</p><pre>yarn --version</pre><h3>Visual Studio Code</h3><p>According to the Visual Studio Code <a href="https://code.visualstudio.com/docs/editor/whyvscode">website</a>, it combines the simplicity of a source code editor with a powerful developer tooling, like IntelliSense code completion and debugging.</p><p>It is available for macOS, Linux, and Windows. Aditionally, it’s a very active Open Source project. I highly recommend it to work with any Angular, Node or TypeScript project.</p><p>You can find the installer <a href="https://code.visualstudio.com/download">here</a>.</p><h3>HTTP Server</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/0*Fm2MxlRxIdP64RVM.png" /></figure><p>This is a command-line http server, which allows you to serving up static files in a simple way. You can use it for testing purposes and local development. Http server can be installed doing:</p><pre>npm install -g http-server</pre><p>Take a look on the <a href="https://github.com/indexzero/http-server">GitHub repository</a> to learn more about this powerful tool.</p><p>If you liked this post, be sure to share it with your friends or give it a clap.</p><p>You can follow me on <a href="https://twitter.com/luixaviles"><strong>Twitter</strong></a> and <a href="https://github.com/luixaviles"><strong>GitHub</strong></a> to see more about my work.</p><p>Thank you for reading!<br> — <a href="https://medium.com/u/b529714282d9">Luis Aviles</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccf3c8d61d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>