SlideShare a Scribd company logo
1 of 23
Understanding Akka
WebSocket.
Presenter:
Ayush Pathak.
Tushar Dhiman.
Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
▪ Punctuality
Join the session 5 minutes prior to the session start time. We start on
time and conclude on time!
▪ Feedback
Make sure to submit a constructive feedback for all sessions as it is very
helpful for the presenter.
▪ Silent Mode
Keep your mobile devices in silent mode, feel free to move out of session
in case you need to attend an urgent call.
▪ Avoid Disturbance
Avoid unwanted chit chat during the session.
Agenda
1. Introduction
o What is WebSocket
o WebSocket Communication
o Use cases of WebSocket
2. WebSocket vs HTTP
3. Overview of Akka Actor
4. Akka HTTP and Its Features
5. Overview of Akka Stream
6. Akka support for WebSocket
7. Demo
Introduction: What is
WebSocket.
What is WebSocket.
▪ WebSocket function as a communication protocol, offering
full-duplex communication channels over a single, persistent
TCP (Transmission Control Protocol) connection.
▪ They designed this to overcome some limitations inherent in
traditional HTTP (Hypertext Transfer Protocol)
communication, which primarily relies on a request-response
model.
▪ WebSocket find frequent application in web-based
functionalities, facilitating real-time features like live chat,
notifications, collaborative editing, financial trading platforms,
and online gaming.
WebSocket Communication
▪ Handshake Initiation: WebSocket starts with a
handshake between the client and server,
utilizing the HTTP protocol, setting the
groundwork for the subsequent transition.
▪ HTTP Protocol Utilization: The handshake
relies on the HTTP protocol, ensuring
compatibility and smooth integration within
existing web infrastructures.
▪ Transition to WebSocket: After a successful
handshake, the connection seamlessly shifts
from HTTP to the WebSocket protocol.
▪ Bidirectional Communication: WebSocket
activation enables bidirectional communication
between the client and server.
What are WebSocket used for?
WebSocket enable real-time bidirectional communication between a client (typically a web
browser) and a server through a single, persistent TCP connection. This technology proves
especially effective in scenarios where low-latency, high-throughput, and real-time updates are
essential.
Consequently, here are some common use cases for WebSocket:
Real-Time Web Applications:
▪ WebSocket find extensive use in developing real-time web applications, including chat
applications, collaborative document editing and live streaming. The bidirectional nature of
WebSocket allows instant communication between clients and servers.
Online Gaming:
▪ Online gaming frequently relies on WebSocket to enable real-time communication between
players and the game server. This is crucial for multiplayer games where quick responses and
synchronization are essential for a seamless gaming experience.
What are WebSocket used for?
Notifications and Alerts:
▪ WebSocket serve to deliver instant notifications and alerts to users. This can include push
notifications for updates, system alerts, or any event-triggered communication that requires
immediate attention.
IOT(Internet of Things):
▪ In IoT applications, WebSocket serve for bidirectional communication between IoT devices and
the server. This allows for real-time monitoring, control, and updates in scenarios like smart
homes, industrial automation, and connected vehicles.
WebSocket vs HTTP.
▪ Encryption: WebSocket can be used over
a secure connection (WSS - WebSocket Secure)
to encrypt the data, providing a secure
channel similar to HTTP.
▪ Real-Time Applications: WebSocket
are ideal for real-time applications where low
latency and bidirectional communication are
essential, such as chat applications, online
gaming, and live updates.
▪ Long-Lived Connections: WebSocket keep
the connection open for an extended
period, allowing for efficient communication
without the need to repeatedly establish
connections.
WebSocket
▪ Encryption: HTTP encrypts the
communication between the client and the
server, providing a secure and private channel. It
uses TLS (Transport Layer Security) or its
predecessor, SSL (Secure Sockets Layer), to
encrypt the data.
▪ Web Pages: HTTP is used for
loading secure web pages, where sensitive
information such as login credentials or personal
data is transmitted.
▪ Short-Lived Connections: In HTTP,
each interaction typically involves a short-
lived connection. The client establishes a
connection for a request, and the connection is
closed after the response is received.
HTTP
WebSocket vs HTTP.
WebSocket:
• Full-Duplex: WebSocket provide full-
duplex communication, allowing both the
client and server to send messages
independently over the same, long-lived connection.
• Bidirectional: Either the client or the
server can initiate communication at any time.
HTTP:
• Request-Response: HTTP is
primarily based on the request-response
model. A client sends a request to a server,
and the server responds with the requested
data.
• Stateless: Each request from the
client is independent, and the server does
not maintain any state between requests.
Akka Actor
Akka Actor.
▪ An actor is an entity which communicates to other actor by message passing. Actor has it's
own state and behaviour.
▪ As in object-oriented programming everything is an object same like everything is an actor in
actor-based system. In other words, we can say that an actor is an object that encapsulates
state and behaviour.
▪ Actors provide a higher level of abstraction to write concurrent and distributed programs.
Roughly speaking, an Actor is a unit of concurrently manageable work and its associated state.
▪ An Actor’s state is strictly private to an actor. Only way to communicate with an Actor is by
sending messages to it.
Actor Model.
Mailboxes
▪ Actors have mailboxes attached to them. Mailboxes are nothing but a queue data structure,
which can be concurrently accessed. Messages sent to an actor are queued in mailboxes.
▪ Messages in a mailbox are dispatched to an Actor one at a time in order.
Dispatchers
▪ Dispatchers the execution engine for Actors. Dispatchers internally manage a thread pool on
which Actors are scheduled and execute the message handling code.
Akka HTTP.
Akka HTTP: Introduction
▪ Akka HTTP is a powerful, open-source toolkit for building scalable, high-performance web
applications in Scala. Developed on top of the Akka toolkit, it brings the actor-based
concurrency model into the world of web development.
▪ Akka HTTP simplifies the integration of WebSocket communication into our applications.
It offers a high-level API for handling WebSocket connections, allowing developers to focus
on business logic rather than dealing with low-level details.
▪ With Akka HTTP, you can easily establish WebSocket connections, handle incoming
messages, and broadcast updates to connected clients.
Key Features
▪ Actor-Based Concurrency: Akka HTTP leverages the Actor model, providing a scalable and
efficient way to handle concurrent requests. Each HTTP request is processed by lightweight,
isolated actors, ensuring optimal resource utilization.
▪ Streaming Capabilities: With Akka HTTP, streaming is a first-class citizen. It supports both
client and server streaming, making it ideal for scenarios where handling large amounts of data
in real-time is crucial.
▪ RESTful Routing: Akka HTTP simplifies the process of defining RESTful APIs through a
concise and expressive routing DSL (Domain Specific Language). This allows developers to
map HTTP requests to specific actions with ease.
Key Features
▪ Comprehensive WebSocket Support: Akka HTTP provides seamless integration for
WebSocket communication. Its high-level API simplifies the establishment of WebSocket
connections, allowing bidirectional communication for real-time applications.
▪ Actor-Based Concurrency Model: Akka HTTP leverages the Actor model, a paradigm
for concurrent and distributed computing, to manage WebSocket connections efficiently. Actors
in Akka provide a lightweight, isolated concurrency unit, making it easier to handle
multiple WebSocket connections concurrently without compromising performance or
introducing complex synchronization mechanisms.
Akka Streams
Akka Streams
▪ Akka-Stream is a module built on top of Akka Actors. It means there are underlying actors that
are working in transferring data.
▪ It is a library to process and transfer a sequence of elements.
▪ Akka Streams is nonblocking that means a certain operation does not hinder the progress of
the calling thread.
▪ It provides easy-to-use APIs to create streams that leverage the power of the Akka toolkit
without explicitly defining actor behaviors and messages. That means, a relief from handling
actors yourself.
▪ We can focus on logic rather than focusing on how to manage actors and that can be much
productive.
Basic Terminology in Akka-Streams
Akka streams consist of 3 major components in it – Source, Flow, Sink – and any non-cyclical
stream consist of at least 2 components Source, Sink and any number of Flow element. Here we
can say Source and Sink are the special cases of Flow.
▪ Source – this is the Source of data. It has exactly one output. We can think of Source as
Publisher.
▪ Sink – this is the Receiver of data. It has exactly one input. We can think of Sink as Receiver.
▪ Flow – this is the Transformation that acts on the Source. It has exactly one input and one
output.
Here Flow sits in between the Source and Sink as they are the Transformations applied on the
Source data.
Akka HTTP Support for WebSocket.
▪ Akka HTTP boasts robust support for WebSocket
communication, providing developers with a powerful toolkit
for implementing real-time, bidirectional data exchange in
their Scala-based web applications.
▪ Leveraging the underlying actor-based concurrency model,
Akka HTTP simplifies WebSocket integration, allowing for
the creation of efficient and scalable solutions.
▪ With dedicated APIs for handling WebSocket connections,
developers can seamlessly implement features such as
message processing and connection management.
▪ Akka HTTP's support for WebSocket enhances the toolkit's
versatility, making it a compelling choice for building
responsive and dynamic web applications that require
instant updates and interactive user experiences.
Demo
Thank you

More Related Content

Similar to Understanding Akka WebSockets A Comprehensive Guide.pptx

Building and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemBuilding and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemKapil Reddy
 
D1-3-Signaling
D1-3-SignalingD1-3-Signaling
D1-3-SignalingOleg Levy
 
Akka for big data developers
Akka for big data developersAkka for big data developers
Akka for big data developersTaras Fedorov
 
API Design and WebSocket
API Design and WebSocketAPI Design and WebSocket
API Design and WebSocketFrank Greco
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service IntroductionMadhukar Kumar
 
How to Create Blockchain Products by Slice.Market CTO
How to Create Blockchain Products by Slice.Market CTOHow to Create Blockchain Products by Slice.Market CTO
How to Create Blockchain Products by Slice.Market CTOProduct School
 
Building REST API using Akka HTTP with Scala
Building REST API using Akka HTTP with ScalaBuilding REST API using Akka HTTP with Scala
Building REST API using Akka HTTP with ScalaKnoldus Inc.
 
Netflix Massively Scalable, Highly Available, Immutable Infrastructure
Netflix Massively Scalable, Highly Available, Immutable InfrastructureNetflix Massively Scalable, Highly Available, Immutable Infrastructure
Netflix Massively Scalable, Highly Available, Immutable InfrastructureAmer Ather
 
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...apidays
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...Edward Burns
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - TalkMatthias Noback
 
Day in the life event-driven workshop
Day in the life  event-driven workshopDay in the life  event-driven workshop
Day in the life event-driven workshopChristina Lin
 
Streaming to a New Jakarta EE
Streaming to a New Jakarta EEStreaming to a New Jakarta EE
Streaming to a New Jakarta EEJ On The Beach
 
Streaming to a new Jakarta EE
Streaming to a new Jakarta EEStreaming to a new Jakarta EE
Streaming to a new Jakarta EEMarkus Eisele
 
Real-Time with Flowdock
Real-Time with FlowdockReal-Time with Flowdock
Real-Time with FlowdockFlowdock
 
Web technology-guide
Web technology-guideWeb technology-guide
Web technology-guideSrihari
 

Similar to Understanding Akka WebSockets A Comprehensive Guide.pptx (20)

Building and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemBuilding and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub System
 
D1-3-Signaling
D1-3-SignalingD1-3-Signaling
D1-3-Signaling
 
Akka for big data developers
Akka for big data developersAkka for big data developers
Akka for big data developers
 
API Design and WebSocket
API Design and WebSocketAPI Design and WebSocket
API Design and WebSocket
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
 
Pune Ruby Meetup - November 2015
Pune Ruby Meetup - November 2015Pune Ruby Meetup - November 2015
Pune Ruby Meetup - November 2015
 
How to Create Blockchain Products by Slice.Market CTO
How to Create Blockchain Products by Slice.Market CTOHow to Create Blockchain Products by Slice.Market CTO
How to Create Blockchain Products by Slice.Market CTO
 
Building REST API using Akka HTTP with Scala
Building REST API using Akka HTTP with ScalaBuilding REST API using Akka HTTP with Scala
Building REST API using Akka HTTP with Scala
 
Netflix Massively Scalable, Highly Available, Immutable Infrastructure
Netflix Massively Scalable, Highly Available, Immutable InfrastructureNetflix Massively Scalable, Highly Available, Immutable Infrastructure
Netflix Massively Scalable, Highly Available, Immutable Infrastructure
 
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
 
ClientServer Websocket.pptx
ClientServer Websocket.pptxClientServer Websocket.pptx
ClientServer Websocket.pptx
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Day in the life event-driven workshop
Day in the life  event-driven workshopDay in the life  event-driven workshop
Day in the life event-driven workshop
 
Web server
Web serverWeb server
Web server
 
0130225347
01302253470130225347
0130225347
 
Streaming to a New Jakarta EE
Streaming to a New Jakarta EEStreaming to a New Jakarta EE
Streaming to a New Jakarta EE
 
Streaming to a new Jakarta EE
Streaming to a new Jakarta EEStreaming to a new Jakarta EE
Streaming to a new Jakarta EE
 
Real-Time with Flowdock
Real-Time with FlowdockReal-Time with Flowdock
Real-Time with Flowdock
 
Web technology-guide
Web technology-guideWeb technology-guide
Web technology-guide
 

More from Knoldus Inc.

GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfKnoldus Inc.
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxKnoldus Inc.
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingKnoldus Inc.
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesKnoldus Inc.
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxKnoldus Inc.
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxKnoldus Inc.
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxKnoldus Inc.
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxKnoldus Inc.
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxKnoldus Inc.
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationKnoldus Inc.
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationKnoldus Inc.
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIsKnoldus Inc.
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II PresentationKnoldus Inc.
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAKnoldus Inc.
 
Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Knoldus Inc.
 
Azure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptxAzure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptxKnoldus Inc.
 
The Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and KotlinThe Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and KotlinKnoldus Inc.
 
Data Engineering with Databricks Presentation
Data Engineering with Databricks PresentationData Engineering with Databricks Presentation
Data Engineering with Databricks PresentationKnoldus Inc.
 
Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)Knoldus Inc.
 

More from Knoldus Inc. (20)

GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptx
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 
Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)
 
Azure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptxAzure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptx
 
The Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and KotlinThe Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and Kotlin
 
Data Engineering with Databricks Presentation
Data Engineering with Databricks PresentationData Engineering with Databricks Presentation
Data Engineering with Databricks Presentation
 
Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 

Understanding Akka WebSockets A Comprehensive Guide.pptx

  • 2. Lack of etiquette and manners is a huge turn off. KnolX Etiquettes ▪ Punctuality Join the session 5 minutes prior to the session start time. We start on time and conclude on time! ▪ Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. ▪ Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call. ▪ Avoid Disturbance Avoid unwanted chit chat during the session.
  • 3. Agenda 1. Introduction o What is WebSocket o WebSocket Communication o Use cases of WebSocket 2. WebSocket vs HTTP 3. Overview of Akka Actor 4. Akka HTTP and Its Features 5. Overview of Akka Stream 6. Akka support for WebSocket 7. Demo
  • 5. What is WebSocket. ▪ WebSocket function as a communication protocol, offering full-duplex communication channels over a single, persistent TCP (Transmission Control Protocol) connection. ▪ They designed this to overcome some limitations inherent in traditional HTTP (Hypertext Transfer Protocol) communication, which primarily relies on a request-response model. ▪ WebSocket find frequent application in web-based functionalities, facilitating real-time features like live chat, notifications, collaborative editing, financial trading platforms, and online gaming.
  • 6. WebSocket Communication ▪ Handshake Initiation: WebSocket starts with a handshake between the client and server, utilizing the HTTP protocol, setting the groundwork for the subsequent transition. ▪ HTTP Protocol Utilization: The handshake relies on the HTTP protocol, ensuring compatibility and smooth integration within existing web infrastructures. ▪ Transition to WebSocket: After a successful handshake, the connection seamlessly shifts from HTTP to the WebSocket protocol. ▪ Bidirectional Communication: WebSocket activation enables bidirectional communication between the client and server.
  • 7. What are WebSocket used for? WebSocket enable real-time bidirectional communication between a client (typically a web browser) and a server through a single, persistent TCP connection. This technology proves especially effective in scenarios where low-latency, high-throughput, and real-time updates are essential. Consequently, here are some common use cases for WebSocket: Real-Time Web Applications: ▪ WebSocket find extensive use in developing real-time web applications, including chat applications, collaborative document editing and live streaming. The bidirectional nature of WebSocket allows instant communication between clients and servers. Online Gaming: ▪ Online gaming frequently relies on WebSocket to enable real-time communication between players and the game server. This is crucial for multiplayer games where quick responses and synchronization are essential for a seamless gaming experience.
  • 8. What are WebSocket used for? Notifications and Alerts: ▪ WebSocket serve to deliver instant notifications and alerts to users. This can include push notifications for updates, system alerts, or any event-triggered communication that requires immediate attention. IOT(Internet of Things): ▪ In IoT applications, WebSocket serve for bidirectional communication between IoT devices and the server. This allows for real-time monitoring, control, and updates in scenarios like smart homes, industrial automation, and connected vehicles.
  • 9. WebSocket vs HTTP. ▪ Encryption: WebSocket can be used over a secure connection (WSS - WebSocket Secure) to encrypt the data, providing a secure channel similar to HTTP. ▪ Real-Time Applications: WebSocket are ideal for real-time applications where low latency and bidirectional communication are essential, such as chat applications, online gaming, and live updates. ▪ Long-Lived Connections: WebSocket keep the connection open for an extended period, allowing for efficient communication without the need to repeatedly establish connections. WebSocket ▪ Encryption: HTTP encrypts the communication between the client and the server, providing a secure and private channel. It uses TLS (Transport Layer Security) or its predecessor, SSL (Secure Sockets Layer), to encrypt the data. ▪ Web Pages: HTTP is used for loading secure web pages, where sensitive information such as login credentials or personal data is transmitted. ▪ Short-Lived Connections: In HTTP, each interaction typically involves a short- lived connection. The client establishes a connection for a request, and the connection is closed after the response is received. HTTP
  • 10. WebSocket vs HTTP. WebSocket: • Full-Duplex: WebSocket provide full- duplex communication, allowing both the client and server to send messages independently over the same, long-lived connection. • Bidirectional: Either the client or the server can initiate communication at any time. HTTP: • Request-Response: HTTP is primarily based on the request-response model. A client sends a request to a server, and the server responds with the requested data. • Stateless: Each request from the client is independent, and the server does not maintain any state between requests.
  • 12. Akka Actor. ▪ An actor is an entity which communicates to other actor by message passing. Actor has it's own state and behaviour. ▪ As in object-oriented programming everything is an object same like everything is an actor in actor-based system. In other words, we can say that an actor is an object that encapsulates state and behaviour. ▪ Actors provide a higher level of abstraction to write concurrent and distributed programs. Roughly speaking, an Actor is a unit of concurrently manageable work and its associated state. ▪ An Actor’s state is strictly private to an actor. Only way to communicate with an Actor is by sending messages to it.
  • 13. Actor Model. Mailboxes ▪ Actors have mailboxes attached to them. Mailboxes are nothing but a queue data structure, which can be concurrently accessed. Messages sent to an actor are queued in mailboxes. ▪ Messages in a mailbox are dispatched to an Actor one at a time in order. Dispatchers ▪ Dispatchers the execution engine for Actors. Dispatchers internally manage a thread pool on which Actors are scheduled and execute the message handling code.
  • 15. Akka HTTP: Introduction ▪ Akka HTTP is a powerful, open-source toolkit for building scalable, high-performance web applications in Scala. Developed on top of the Akka toolkit, it brings the actor-based concurrency model into the world of web development. ▪ Akka HTTP simplifies the integration of WebSocket communication into our applications. It offers a high-level API for handling WebSocket connections, allowing developers to focus on business logic rather than dealing with low-level details. ▪ With Akka HTTP, you can easily establish WebSocket connections, handle incoming messages, and broadcast updates to connected clients.
  • 16. Key Features ▪ Actor-Based Concurrency: Akka HTTP leverages the Actor model, providing a scalable and efficient way to handle concurrent requests. Each HTTP request is processed by lightweight, isolated actors, ensuring optimal resource utilization. ▪ Streaming Capabilities: With Akka HTTP, streaming is a first-class citizen. It supports both client and server streaming, making it ideal for scenarios where handling large amounts of data in real-time is crucial. ▪ RESTful Routing: Akka HTTP simplifies the process of defining RESTful APIs through a concise and expressive routing DSL (Domain Specific Language). This allows developers to map HTTP requests to specific actions with ease.
  • 17. Key Features ▪ Comprehensive WebSocket Support: Akka HTTP provides seamless integration for WebSocket communication. Its high-level API simplifies the establishment of WebSocket connections, allowing bidirectional communication for real-time applications. ▪ Actor-Based Concurrency Model: Akka HTTP leverages the Actor model, a paradigm for concurrent and distributed computing, to manage WebSocket connections efficiently. Actors in Akka provide a lightweight, isolated concurrency unit, making it easier to handle multiple WebSocket connections concurrently without compromising performance or introducing complex synchronization mechanisms.
  • 19. Akka Streams ▪ Akka-Stream is a module built on top of Akka Actors. It means there are underlying actors that are working in transferring data. ▪ It is a library to process and transfer a sequence of elements. ▪ Akka Streams is nonblocking that means a certain operation does not hinder the progress of the calling thread. ▪ It provides easy-to-use APIs to create streams that leverage the power of the Akka toolkit without explicitly defining actor behaviors and messages. That means, a relief from handling actors yourself. ▪ We can focus on logic rather than focusing on how to manage actors and that can be much productive.
  • 20. Basic Terminology in Akka-Streams Akka streams consist of 3 major components in it – Source, Flow, Sink – and any non-cyclical stream consist of at least 2 components Source, Sink and any number of Flow element. Here we can say Source and Sink are the special cases of Flow. ▪ Source – this is the Source of data. It has exactly one output. We can think of Source as Publisher. ▪ Sink – this is the Receiver of data. It has exactly one input. We can think of Sink as Receiver. ▪ Flow – this is the Transformation that acts on the Source. It has exactly one input and one output. Here Flow sits in between the Source and Sink as they are the Transformations applied on the Source data.
  • 21. Akka HTTP Support for WebSocket. ▪ Akka HTTP boasts robust support for WebSocket communication, providing developers with a powerful toolkit for implementing real-time, bidirectional data exchange in their Scala-based web applications. ▪ Leveraging the underlying actor-based concurrency model, Akka HTTP simplifies WebSocket integration, allowing for the creation of efficient and scalable solutions. ▪ With dedicated APIs for handling WebSocket connections, developers can seamlessly implement features such as message processing and connection management. ▪ Akka HTTP's support for WebSocket enhances the toolkit's versatility, making it a compelling choice for building responsive and dynamic web applications that require instant updates and interactive user experiences.
  • 22. Demo