Image for post
Image for post

Encryption of production databases can be a very challenging task. It is a very time-consuming operation and during that process, things may go wrong, which is the last thing that you want to do in a production environment. First of all, let’s look into the risks of doing such a procedure.

The Risks


Image for post
Image for post

Yesterday I came across to a problem when the decorator design pattern was really needed, but NodeJS does not support it natively. I’ve decided to implement my own and share it with you. Let’s start.

The problem

There is one single backend that has multiple clients each of them can make a request to the backend and receive a response. Writing each request handler for every client is a headache and can cause a lot of duplicate code because the data is almost the same except the format. …


Image for post
Image for post

Introduction

Hello, I’m Melik. I’ve been working In Krisp since the foundation of the company and during that period I’ve written a couple of APIs for audio processing. And what I’ve learnt is that a huge problem arises when you want to recreate the infrastructure that you have been managing by hand.

We’ve been using AWS and all our infrastructure was there. I’ve created the first API by configuring it by hand. And every time I needed something I went to the console and created all the resources that I need. …


Recently I’ve been doing a web project which had to use WebSockets. And it was a very tough task for someone like me who was very unfamiliar with WebSockets to use them freely. So I decided to write this blog post and share with you what I’ve learned.

In the scope of this post, I’ll talk about WebSocket protocol, authentication mechanisms for WebSockets and how to use WebSockets in node js.

WebSocket Protocol

Imagine a scenario where you are building a chat application using HTTP protocol on that case how would you know if you have a new message or not? Because in HTTP protocol client has to initiate a request not the server, the server can not notify the client about new message without being asked for. So one of the solutions is to periodically request the server for new messages. This technic is called polling and it results in a lot of requests to the server. Besides lots of requests being made to the server it also delivers delay. Another approach for solving this problem is to make a long living HTTP request to the server and leave the connection open until a new message is received and then open a new connection again waiting for another message. This technic is called long-polling, which results in many open connections and is not efficient as well. But what if there was some method for the server to notify the client without being asked by the client. That would solve the overhead caused by polling and long-polling. And here the WebSocket protocol comes. It enables two-way communication between the server and the client, which provides a good solution for real-time applications like chatting, gaming etc. …

About

Melik Karapetyan

Principal engineer at Krisp

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store