WebSockets Explained: A Journey into Real-Time Communication

WebSocket is a two-way, full-duplex protocol utilized in client-server communication contexts. As a stateful protocol, the connection between the client and server remains active until terminated by either party. Once the connection is closed by either the client or server, the connection ends on both sides.

Sample webSocket URI

A WebSocket URI has the following format:

ws://hostname:port/path?query

For secure WebSocket connections, the scheme would be wss:

wss://hostname:port/path?query

Here’s an example of a WebSocket URI:

[Read More]

NetMQ: Breaking Down the Basics

NetMQ is a .NET library that provides a high-level API for several messaging patterns, allowing applications to communicate with each other over a network. It’s a 100% native C# port of the lightweight messaging library ZeroMQ.

NetMQ is transport-agnostic and can work over several transports such as inproc (inter-thread, inter-process), IPC (inter-process), TCP, and more. It’s designed to handle high load, is very flexible, and doesn’t require a dedicated message broker.

[Read More]
netmq 

Self-Signed TLS Certificates in Browsers

I recently had the need to create a self-signed certificate for one of our web applications wherein the browser does not display a warning message indicating Your connection is not private with the error NET::ERR_CERT_AUTHORITY_INVALID. It was necessary to create certificates for several domains, such as www.subdomain.example.com and www.myblog.sample.com.

A self-signed SSL/TLS certificate must be an X.509 version 3 multidomain SAN certificate and requires a root certificate.

A single certificate can be created for both domains using Subject Alternative Name (SAN).

[Read More]
tls 

Understanding AWS SAM: A Serverless Infrastructure

A serverless lambda function has to be designed, developed, built, debugged, and tested locally for my project. AWS Serverless Application Model (AWS SAM) is something that I came upon.

AWS SAM consists of two primary parts:

  1. AWS SAM template specification – An open-source framework that we can use to define our serverless application infrastructure on AWS.
  2. AWS SAM command line interface (AWS SAM CLI) – A command line tool that we can use with AWS SAM templates to build and run the serverless applications.

The SAM CLI offers a number of methods for locally creating, building, executing, and debugging lambda functions. Let’s explore with a Python sample project.

[Read More]
AWS 

Passing environment variables to docker compose & containers

The .env file serves as a mechanism to set environment variables. Sometimes, it’s necessary to ensure these values can be accessed within the containers. At other times, it’s crucial to restrict these variables to the Docker Compose file only.

Upon examining an issue with our product, I discovered that the approach to provide variables to a Compose file differs from the strategies used to pass environment variables to containers. Let’s explore the possible solutions.

[Read More]
docker 

Understanding Linux: A Closer Look at File Permissions

There are three categories: User (the file’s owner), Group (the security group you’re in), and Other (for others). Each category allows to establish three permissions: r, w, and x to read, write, and execute a file, respectively. Permissions are denoted by three numbers: 4 for Read, 2 for Write, and 1 for Execute. As a quick reference, here is a table:

User Group Other
Read = 4 x x x
Write = 2 x
Execute = 1 x x x
Totals (4+2+1) = 7 (4 + 1) = 5 (4 + 1) = 5

The single-digit numbers are as follows for all three user categories:

[Read More]
linux 

Docker: A Closer Look at Volumes and Bind Mount

Docker images are read-only. However, containers put a thin “read-write layer” on top of the image. That is, they can change the files and folders in the image without actually changing the image. If the container is stopped and removed, all data written in it is lost. There are different options to manage the data.

docker-volumes-binds

Volumes

Volumes are folders (and files) on your host machine that are linked to folders / files within a container. Docker creates and manages volumes.

[Read More]
docker 

Docker Communication: Breaking Down Container Interactions

In many applications, there are more than one containers running. There are different communications involved

  1. Containers communicating with host machine
  2. Containers communicating with each other
  3. containers communicating with internet

docker-communication

Communication with host machine

By default, Docker containers cannot access the host machine’s network since they are segregated from it. Using the hostname “host.docker.internal” is one method of allowing containers to access the network of the host system. A unique address called host.docker.internal is converted by Docker to the IP address of the server running the container.

[Read More]
docker 

Decoding Assembly Version and Assembly File Version

Microsoft .NET framework provides an opportunity to set two different types of version numbers for each assembly.

  • Assembly Version
  • Assembly file version

Assembly version

It’s the version number that the framework uses to locate, link, and load assemblies during build and runtime. This version number is embedded whenever you add a reference to any assembly in your project. Common Language Runtime (CLR) searches for assemblies with this version number to load at runtime. However, keep in mind that this version, along with the name, public key token, and culture information, is only used if the assemblies are strong-named signed. Only file names are used for loading if assemblies are not strong-named signed.

[Read More]
dotnet 

Demystifying .NET Decompilers

Code written in C#, VB.NET, or F# is converted into IL code, or Intermediate Language, during compilation. A DLL file is then used to store this IL code. The JIT compiler compiles the IL code contained in the DLLs to native code at runtime. The CPU then starts executing the native code directly. JIT, or just-in-time, compilation refers to the process of only compiling IL code into native code when a method is called for the first time during runtime.

[Read More]
dotnet