Building a chat application using SvelteJS and SSE

Click for: original source

If you’ve already developed web applications with ReactJS or VueJS, you’ve probably heard of SvelteJS. In this article, author will explore this new framework to discover its subtleties, and show you how it is not so different from others (on the surface). By Julien Demangeon.

We will take advantage of this experience to use the SSE (Server Sent Event) protocol for data exchanges in the same time. It has been confidential for a long time but it is more and more used.

In the mid-2010s, ReactJS and VueJS changed the game by introducing the concept of “Virtual DOM” and thus reducing the number of mutations on the DOM, which are very slow.

SvelteJS was developed by Rich Harris, who is also the creator of the JavaScript compiler / bundler called RollupJS. The first version of the library was released at the end of 2016. It has been developed to relieve the browser of the unnecessary and expensive processing introduced by the Virtual DOM diffing of recent frameworks.

Thus, SvelteJS has moved this complexity to the compilation stage, partially reducing the weight of JavaScript bundles and speeding up rendering times.

The article then focuses on building chat application, providing all the necessary code together with good explanation. Svelte is really promising, but its ecosystem is lacking when compared to the major JS frameworks. Nice one!

[Read More]

Tags nodejs JavaScript web-development servers