Infinum Android Talks #17 - A quest for WebSockets by Zeljko PlesacInfinum
Željko will take a closer look into available WebSocket solutions for Android and demonstrate how switching between them using a decoupled architecture and Dagger 2 can be simple and intuitive.
The document describes code for implementing the server-side functionality of a WhatsApp clone. It includes classes for representing users, messages, and server connections. The Server class initializes user and message data from files, handles login/signup, and establishes a websocket connection for real-time messaging. It can send and receive messages when connected, or queue messages when offline.
Managing State in React Apps with RxJS by James Wright at FrontCon 2019DevClub_lv
Redux is one of the most popular technologies for the management of shared state across entire React applications, which can be complemented by Redux Observable to describe asynchronous side effects with RxJS. This approach, however, adds cognitive load when balancing the varying concepts across these three libraries. What if we could use RxJS exclusively for managing state in our React apps? This talk will demonstrate this possibility and the benefits it provides.
Explaining the benefits of using WebSockets, the difference comparing with Ajax and explaining the code we should write on both ends. The server and the client.
More information about the Java course I deliver can be found at java.course.lifemichael.com
More information about the Node.js course I deliver can be found at nodejs.course.lifemichael.com
More information about the FED course I deliver can be found at fed.course.lifemichael.com
WebSockets is an emerging standard that enables real-time and bidirectional communication across the Web. You will learn how HTML5 web applications can make dramatic improvements in terms of user experience and performance by taking advantage of this technology. In this session we will focus on the new WCF 4.5 and ASP.NET 4.5 APIs supporting this standard.
WebSockets allow for bidirectional communication over a single socket connection. Once a WebSocket connection is established between a web browser and web server, data can be transmitted both ways using send() and onmessage event handlers. The WebSocket API creates a WebSocket object that has attributes like readyState to check connection status and methods like send() to transmit data and close() to terminate the connection. A WebSocket server like mod_pywebsocket for Apache must be installed and run to test WebSocket functionality between client and server code.
Infinum Android Talks #17 - A quest for WebSockets by Zeljko PlesacInfinum
Željko will take a closer look into available WebSocket solutions for Android and demonstrate how switching between them using a decoupled architecture and Dagger 2 can be simple and intuitive.
The document describes code for implementing the server-side functionality of a WhatsApp clone. It includes classes for representing users, messages, and server connections. The Server class initializes user and message data from files, handles login/signup, and establishes a websocket connection for real-time messaging. It can send and receive messages when connected, or queue messages when offline.
Managing State in React Apps with RxJS by James Wright at FrontCon 2019DevClub_lv
Redux is one of the most popular technologies for the management of shared state across entire React applications, which can be complemented by Redux Observable to describe asynchronous side effects with RxJS. This approach, however, adds cognitive load when balancing the varying concepts across these three libraries. What if we could use RxJS exclusively for managing state in our React apps? This talk will demonstrate this possibility and the benefits it provides.
Explaining the benefits of using WebSockets, the difference comparing with Ajax and explaining the code we should write on both ends. The server and the client.
More information about the Java course I deliver can be found at java.course.lifemichael.com
More information about the Node.js course I deliver can be found at nodejs.course.lifemichael.com
More information about the FED course I deliver can be found at fed.course.lifemichael.com
WebSockets is an emerging standard that enables real-time and bidirectional communication across the Web. You will learn how HTML5 web applications can make dramatic improvements in terms of user experience and performance by taking advantage of this technology. In this session we will focus on the new WCF 4.5 and ASP.NET 4.5 APIs supporting this standard.
WebSockets allow for bidirectional communication over a single socket connection. Once a WebSocket connection is established between a web browser and web server, data can be transmitted both ways using send() and onmessage event handlers. The WebSocket API creates a WebSocket object that has attributes like readyState to check connection status and methods like send() to transmit data and close() to terminate the connection. A WebSocket server like mod_pywebsocket for Apache must be installed and run to test WebSocket functionality between client and server code.
Mobile Software Engineering Crash Course - C06 WindowsPhoneMohammad Shaker
The document provides an overview of mobile software engineering for Windows Phone, discussing tools and frameworks like the Windows Phone SDK, Silverlight, MVVM, data binding, navigation, and WebClient; it also mentions game development with XNA and using touch events to control a particle engine. Code samples demonstrate common tasks like data binding, navigation, and downloading data with WebClient.
Creating the interfaces of the future with the APIs of todaygerbille
The document discusses creating futuristic interfaces using web technologies like WebSockets, WebGL, and device APIs. It provides examples of syncing device orientation over WebSockets between clients, accessing the device camera with getUserMedia, and using head tracking with headtrackr.js to control the camera in a 3D scene rendered with three.js. Links are included for related projects on Wiimote control, head tracking examples, and touch tracking demos.
Did you know that the .NET compiler turns our async methods into classes? And that .NET adds a try/catch block to each of these classes, potentially hiding thrown exceptions? It's true!
In this session, we will learn how to best use async/await in C# by analyzing how .NET compiles our async code.
Join me as we take an existing app and optimize its async code together, showing off performance gains, better exception handling, improved run-time speed, smaller app size and more using the latest tools in C#12 + .NET 8!
This slide deck (partly German) covers async and parallel programming topics for .NET and C#. For details see http://www.software-architects.com/devblog/2014/02/18/BASTA-2014-Spring-C-Workshop
Hybrid development using Qt WebKit allows developers to embed a fully functional web browser inside a Qt application. Qt WebKit provides a bridge between Qt and the WebKit rendering engine, allowing developers to load web content, manipulate web pages, and integrate their applications with web services. Developers can inject QObjects into web pages to expose slots, properties, and signals to JavaScript, and can also call JavaScript functions and extract their return values from the C++ side.
4Developers 2018: Real-time capabilities in ASP.NET Core web applications (To...PROIDEA
This talk won't be about SignalR (it will be mentioned but that's all). It will focus on native techniques like WebSockets, Server-Sent Events and Push API. It will show how to use them and suggest when to use them by exploring their strong and weak sides.
Sample JavaScript Code Laurence Svekis
JavaScript Closure
A closure in JavaScript is a function that has access to the variables in its parent scope, even after the parent function has completed execution. This allows for data to be “closed over” or remembered by the inner function, even after the outer function has returned.
Here, the makeCounter function returns an inner function that has access to the count variable declared in its parent scope, and can “remember” the current count value even after the makeCounter function has completed execution. Each time the inner function is called, it returns the current value of count and increments it by 1.
JavaScript Closure Advanced
In this example, the makeAdder function takes in a single argument x and returns an inner function that takes in a second argument y. The inner function has access to the x variable declared in the parent scope and uses it to add x and y together and return the result.
We can see here that the outer function makeAdder has been executed twice and it returns two different inner functions which are assigned to different variables add5 and add10 and these inner functions are able to remember their respective parent scope values of x.
Did you know that the .NET compiler turns our async methods into classes? And that .NET adds a try/catch block to each of these classes, potentially hiding thrown exceptions? It's true! In this session, we will learn how to best use async/await in C# by analyzing how .NET compiles our async code. Join me as we take an existing app and optimize its async code together, showing off performance gains, better exception handling, improved run-time speed, and smaller app size!
Implement react pagination with react hooks and react paginateKaty Slemon
ReactJS Pagination using React Hooks. Learn about how to implement pagination with React hooks and React paginate to manage and display the vast data conveniently.
[JEEConf-2017] RxJava as a key component in mature Big Data productIgor Lozynskyi
Zoomdata is the fastest visual analytics product for big data available on the market. Here we will talk about how RxJava became the key component in its architecture. I want to share our experience with reactive programming and RxJava so that audience will learn about “good” and “bad” stuff based on a real and cool product. Besides, we will talk about performance implications and integration with “big names”, including Apache Spark.
Websockets talk at Rubyconf Uruguay 2010Ismael Celis
This document discusses using WebSockets for real-time applications in Ruby. It begins with an overview of WebSockets and use cases. It then covers the WebSocket DOM API, handshake process, and implementing a WebSocket server in Ruby with EventMachine and EM-WebSocket. It provides an example of building a multicast channel application with JSON messages. It also discusses scaling options like Pusher and shows code samples for a Pusher implementation.
The time of static or dynamically generated sites is long gone. Non-stop interaction with users is the new normal. However, polling with Ajax requests is processor intensive and cumbersome. Websockets allow you to interact with users in real-time without increasing system load. We'll go through the basics and see all the different options, illustrated with live examples of how and when to use it, as well as when not to use it.
Are the smartphone wars wearing your out? When asked to choose between Objective-C and Java do you answer “None of the Above”? Do you think app stores are so 1995? Then there is good news for you and it’s called the mobile web. This isn’t about trying to port iFart to the browser, and it’s definitely not about tweaking an existing website so it doesn’t look awful on your mom’s iPhone. It is about writing full featured, engaging applications on the web. This talk is all about how to create killer web apps using HTML5, CSS3, as well as some other not-so-standard technologies available on a wide variety of popular smartphones. We’re talking about multi-threaded, high performance apps that can track your movement or even take pictures of whatever you think is interesting.
This document discusses the Client-Side Object Model (CSOM) for SharePoint. It provides an overview of CSOM and its advantages over Server-Side Object Model (SSOM) and Representational State Transfer (REST). CSOM resembles SSOM, uses strongly typed objects, supports batch requests, handles connection authentication and remote errors. It covers more of the SharePoint API than REST. Examples are provided for creating sites using CSOM in C# and JavaScript. New features in CSOM for SharePoint 2013 and Online are also mentioned.
Did you know that the .NET compiler turns our async methods into classes? And that .NET adds a try/catch block to each of these classes, potentially hiding thrown exceptions? It's true! In this session, we will learn how to best use async/await in C# by analyzing how .NET compiles our async code. Join me as we take an existing app and optimize its async code together, showing off performance gains, better exception handling, improved run-time speed, and smaller app size!
The latest version of the Java EE plataform had three major goals. First, improve developer productivity by introducing more annotations and removing boilerplate code to simplify integration with the plataform. JMS 2 is the perfect example; Second, add first-class support for web standards, including a new API to build WebSockets, a new API to parse, process and generate JSON and a new Client API in JAX-RS 2 to invoke RESTful services; Third, meet the enterprise demands. The long awaited Batch Processing API is now available to build batch processing applications using all the capabilities of the platform itself. The Concurrency Utilities API provides you with asynchronous capabilities. This session will explore all the new features introduced in Java EE 7 and share information to learn, develop and contribute.
This document discusses using WebSockets in Unity games and describes how to implement a finite state machine to handle asynchronous WebSocket events on the main thread. It begins with an overview of WebSockets and their advantages over polling. It then demonstrates how to connect to a WebSocket server and handle events like connection, receiving messages, and disconnection using the WebSocket Sharp library. To address Unity's single-threaded model, it presents a finite state machine pattern that queues asynchronous WebSocket events to be processed on the main thread. Sample code is provided to illustrate setting up and transitioning between states to safely coordinate the WebSocket connection and events.
The world of open source libraries and tools is vast for Android developers. Writing apps using solely Android SDK is impractical. Libraries can help you in many ways. They can speed up your development, save you creating boilerplate code and dealing with platform fragmentation, simplify your code and make it more readable and maintainable. In the talk I’m showing how several truly useful libraries can help a developer.
Presented at MobCon Europe 2017.
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
Mobile Software Engineering Crash Course - C06 WindowsPhoneMohammad Shaker
The document provides an overview of mobile software engineering for Windows Phone, discussing tools and frameworks like the Windows Phone SDK, Silverlight, MVVM, data binding, navigation, and WebClient; it also mentions game development with XNA and using touch events to control a particle engine. Code samples demonstrate common tasks like data binding, navigation, and downloading data with WebClient.
Creating the interfaces of the future with the APIs of todaygerbille
The document discusses creating futuristic interfaces using web technologies like WebSockets, WebGL, and device APIs. It provides examples of syncing device orientation over WebSockets between clients, accessing the device camera with getUserMedia, and using head tracking with headtrackr.js to control the camera in a 3D scene rendered with three.js. Links are included for related projects on Wiimote control, head tracking examples, and touch tracking demos.
Did you know that the .NET compiler turns our async methods into classes? And that .NET adds a try/catch block to each of these classes, potentially hiding thrown exceptions? It's true!
In this session, we will learn how to best use async/await in C# by analyzing how .NET compiles our async code.
Join me as we take an existing app and optimize its async code together, showing off performance gains, better exception handling, improved run-time speed, smaller app size and more using the latest tools in C#12 + .NET 8!
This slide deck (partly German) covers async and parallel programming topics for .NET and C#. For details see http://www.software-architects.com/devblog/2014/02/18/BASTA-2014-Spring-C-Workshop
Hybrid development using Qt WebKit allows developers to embed a fully functional web browser inside a Qt application. Qt WebKit provides a bridge between Qt and the WebKit rendering engine, allowing developers to load web content, manipulate web pages, and integrate their applications with web services. Developers can inject QObjects into web pages to expose slots, properties, and signals to JavaScript, and can also call JavaScript functions and extract their return values from the C++ side.
4Developers 2018: Real-time capabilities in ASP.NET Core web applications (To...PROIDEA
This talk won't be about SignalR (it will be mentioned but that's all). It will focus on native techniques like WebSockets, Server-Sent Events and Push API. It will show how to use them and suggest when to use them by exploring their strong and weak sides.
Sample JavaScript Code Laurence Svekis
JavaScript Closure
A closure in JavaScript is a function that has access to the variables in its parent scope, even after the parent function has completed execution. This allows for data to be “closed over” or remembered by the inner function, even after the outer function has returned.
Here, the makeCounter function returns an inner function that has access to the count variable declared in its parent scope, and can “remember” the current count value even after the makeCounter function has completed execution. Each time the inner function is called, it returns the current value of count and increments it by 1.
JavaScript Closure Advanced
In this example, the makeAdder function takes in a single argument x and returns an inner function that takes in a second argument y. The inner function has access to the x variable declared in the parent scope and uses it to add x and y together and return the result.
We can see here that the outer function makeAdder has been executed twice and it returns two different inner functions which are assigned to different variables add5 and add10 and these inner functions are able to remember their respective parent scope values of x.
Did you know that the .NET compiler turns our async methods into classes? And that .NET adds a try/catch block to each of these classes, potentially hiding thrown exceptions? It's true! In this session, we will learn how to best use async/await in C# by analyzing how .NET compiles our async code. Join me as we take an existing app and optimize its async code together, showing off performance gains, better exception handling, improved run-time speed, and smaller app size!
Implement react pagination with react hooks and react paginateKaty Slemon
ReactJS Pagination using React Hooks. Learn about how to implement pagination with React hooks and React paginate to manage and display the vast data conveniently.
[JEEConf-2017] RxJava as a key component in mature Big Data productIgor Lozynskyi
Zoomdata is the fastest visual analytics product for big data available on the market. Here we will talk about how RxJava became the key component in its architecture. I want to share our experience with reactive programming and RxJava so that audience will learn about “good” and “bad” stuff based on a real and cool product. Besides, we will talk about performance implications and integration with “big names”, including Apache Spark.
Websockets talk at Rubyconf Uruguay 2010Ismael Celis
This document discusses using WebSockets for real-time applications in Ruby. It begins with an overview of WebSockets and use cases. It then covers the WebSocket DOM API, handshake process, and implementing a WebSocket server in Ruby with EventMachine and EM-WebSocket. It provides an example of building a multicast channel application with JSON messages. It also discusses scaling options like Pusher and shows code samples for a Pusher implementation.
The time of static or dynamically generated sites is long gone. Non-stop interaction with users is the new normal. However, polling with Ajax requests is processor intensive and cumbersome. Websockets allow you to interact with users in real-time without increasing system load. We'll go through the basics and see all the different options, illustrated with live examples of how and when to use it, as well as when not to use it.
Are the smartphone wars wearing your out? When asked to choose between Objective-C and Java do you answer “None of the Above”? Do you think app stores are so 1995? Then there is good news for you and it’s called the mobile web. This isn’t about trying to port iFart to the browser, and it’s definitely not about tweaking an existing website so it doesn’t look awful on your mom’s iPhone. It is about writing full featured, engaging applications on the web. This talk is all about how to create killer web apps using HTML5, CSS3, as well as some other not-so-standard technologies available on a wide variety of popular smartphones. We’re talking about multi-threaded, high performance apps that can track your movement or even take pictures of whatever you think is interesting.
This document discusses the Client-Side Object Model (CSOM) for SharePoint. It provides an overview of CSOM and its advantages over Server-Side Object Model (SSOM) and Representational State Transfer (REST). CSOM resembles SSOM, uses strongly typed objects, supports batch requests, handles connection authentication and remote errors. It covers more of the SharePoint API than REST. Examples are provided for creating sites using CSOM in C# and JavaScript. New features in CSOM for SharePoint 2013 and Online are also mentioned.
Did you know that the .NET compiler turns our async methods into classes? And that .NET adds a try/catch block to each of these classes, potentially hiding thrown exceptions? It's true! In this session, we will learn how to best use async/await in C# by analyzing how .NET compiles our async code. Join me as we take an existing app and optimize its async code together, showing off performance gains, better exception handling, improved run-time speed, and smaller app size!
The latest version of the Java EE plataform had three major goals. First, improve developer productivity by introducing more annotations and removing boilerplate code to simplify integration with the plataform. JMS 2 is the perfect example; Second, add first-class support for web standards, including a new API to build WebSockets, a new API to parse, process and generate JSON and a new Client API in JAX-RS 2 to invoke RESTful services; Third, meet the enterprise demands. The long awaited Batch Processing API is now available to build batch processing applications using all the capabilities of the platform itself. The Concurrency Utilities API provides you with asynchronous capabilities. This session will explore all the new features introduced in Java EE 7 and share information to learn, develop and contribute.
This document discusses using WebSockets in Unity games and describes how to implement a finite state machine to handle asynchronous WebSocket events on the main thread. It begins with an overview of WebSockets and their advantages over polling. It then demonstrates how to connect to a WebSocket server and handle events like connection, receiving messages, and disconnection using the WebSocket Sharp library. To address Unity's single-threaded model, it presents a finite state machine pattern that queues asynchronous WebSocket events to be processed on the main thread. Sample code is provided to illustrate setting up and transitioning between states to safely coordinate the WebSocket connection and events.
The world of open source libraries and tools is vast for Android developers. Writing apps using solely Android SDK is impractical. Libraries can help you in many ways. They can speed up your development, save you creating boilerplate code and dealing with platform fragmentation, simplify your code and make it more readable and maintainable. In the talk I’m showing how several truly useful libraries can help a developer.
Presented at MobCon Europe 2017.
Similar to Creating a Whatsapp Clone - Part XV - Transcript.pdf (20)
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
Building RAG with self-deployed Milvus vector database and Snowpark Container...Zilliz
This talk will give hands-on advice on building RAG applications with an open-source Milvus database deployed as a docker container. We will also introduce the integration of Milvus with Snowpark Container Services.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/building-and-scaling-ai-applications-with-the-nx-ai-manager-a-presentation-from-network-optix/
Robin van Emden, Senior Director of Data Science at Network Optix, presents the “Building and Scaling AI Applications with the Nx AI Manager,” tutorial at the May 2024 Embedded Vision Summit.
In this presentation, van Emden covers the basics of scaling edge AI solutions using the Nx tool kit. He emphasizes the process of developing AI models and deploying them globally. He also showcases the conversion of AI models and the creation of effective edge AI pipelines, with a focus on pre-processing, model conversion, selecting the appropriate inference engine for the target hardware and post-processing.
van Emden shows how Nx can simplify the developer’s life and facilitate a rapid transition from concept to production-ready applications.He provides valuable insights into developing scalable and efficient edge AI solutions, with a strong focus on practical implementation.
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIVladimir Iglovikov, Ph.D.
Presented by Vladimir Iglovikov:
- https://www.linkedin.com/in/iglovikov/
- https://x.com/viglovikov
- https://www.instagram.com/ternaus/
This presentation delves into the journey of Albumentations.ai, a highly successful open-source library for data augmentation.
Created out of a necessity for superior performance in Kaggle competitions, Albumentations has grown to become a widely used tool among data scientists and machine learning practitioners.
This case study covers various aspects, including:
People: The contributors and community that have supported Albumentations.
Metrics: The success indicators such as downloads, daily active users, GitHub stars, and financial contributions.
Challenges: The hurdles in monetizing open-source projects and measuring user engagement.
Development Practices: Best practices for creating, maintaining, and scaling open-source libraries, including code hygiene, CI/CD, and fast iteration.
Community Building: Strategies for making adoption easy, iterating quickly, and fostering a vibrant, engaged community.
Marketing: Both online and offline marketing tactics, focusing on real, impactful interactions and collaborations.
Mental Health: Maintaining balance and not feeling pressured by user demands.
Key insights include the importance of automation, making the adoption process seamless, and leveraging offline interactions for marketing. The presentation also emphasizes the need for continuous small improvements and building a friendly, inclusive community that contributes to the project's growth.
Vladimir Iglovikov brings his extensive experience as a Kaggle Grandmaster, ex-Staff ML Engineer at Lyft, sharing valuable lessons and practical advice for anyone looking to enhance the adoption of their open-source projects.
Explore more about Albumentations and join the community at:
GitHub: https://github.com/albumentations-team/albumentations
Website: https://albumentations.ai/
LinkedIn: https://www.linkedin.com/company/100504475
Twitter: https://x.com/albumentations
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Zilliz
Join us to introduce Milvus Lite, a vector database that can run on notebooks and laptops, share the same API with Milvus, and integrate with every popular GenAI framework. This webinar is perfect for developers seeking easy-to-use, well-integrated vector databases for their GenAI apps.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
A tale of scale & speed: How the US Navy is enabling software delivery from l...
Creating a Whatsapp Clone - Part XV - Transcript.pdf
1. Creating a WhatsApp Clone - Part XV
Next we’ll jump to the websocket package which is the last package
2. @Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
@Bean
public ServletServerContainerFactoryBean createWebSocketContainer() {
ServletServerContainerFactoryBean container =
new ServletServerContainerFactoryBean();
container.setMaxTextMessageBufferSize(8192);
container.setMaxBinaryMessageBufferSize(8192);
return container;
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry
registry) {
registry.addHandler(myHandler(), "/socket");
}
@Bean
public WebSocketHandler myHandler() {
AppSocket
First we need to configure the web socket.
We do this by implementing the WebSocketConfigurer and using the annotations on the class to indicate its purpose
3. @Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
@Bean
public ServletServerContainerFactoryBean createWebSocketContainer() {
ServletServerContainerFactoryBean container =
new ServletServerContainerFactoryBean();
container.setMaxTextMessageBufferSize(8192);
container.setMaxBinaryMessageBufferSize(8192);
return container;
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry
registry) {
registry.addHandler(myHandler(), "/socket");
}
@Bean
public WebSocketHandler myHandler() {
AppSocket
We define the socket so we can define the packet size to 8kb. We can set a larger size but generally keeping packets small is a good practice
4. public ServletServerContainerFactoryBean createWebSocketContainer() {
ServletServerContainerFactoryBean container =
new ServletServerContainerFactoryBean();
container.setMaxTextMessageBufferSize(8192);
container.setMaxBinaryMessageBufferSize(8192);
return container;
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry
registry) {
registry.addHandler(myHandler(), "/socket");
}
@Bean
public WebSocketHandler myHandler() {
return new AppSocket();
}
@Bean
public TaskScheduler taskScheduler() {
return new ConcurrentTaskScheduler(Executors.
newSingleThreadScheduledExecutor());
}
AppSocket
The AppSocket class is bound to the /socket URL in this line of code
5. container.setMaxTextMessageBufferSize(8192);
container.setMaxBinaryMessageBufferSize(8192);
return container;
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry
registry) {
registry.addHandler(myHandler(), "/socket");
}
@Bean
public WebSocketHandler myHandler() {
return new AppSocket();
}
@Bean
public TaskScheduler taskScheduler() {
return new ConcurrentTaskScheduler(Executors.
newSingleThreadScheduledExecutor());
}
}
AppSocket
This is the thread used to process the websocket connections. We can allocate more thread resources based on need
6. import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
public class AppSocket extends TextWebSocketHandler {
private static Logger log =
Logger.getLogger(AppSocket.class.getName());
private static final Map<String, List<WebSocketSession>> clients =
new HashMap<>();
@Autowired
private UserService users;
private static boolean sendToToken(String token, String json) {
List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
AppSocket
Next lets go to AppSocket
The app socket is an implementation of TextWebSocketHandler which handles text messages. Since all our messages are JSON this makes more sense.
7. import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
public class AppSocket extends TextWebSocketHandler {
private static Logger log =
Logger.getLogger(AppSocket.class.getName());
private static final Map<String, List<WebSocketSession>> clients =
new HashMap<>();
@Autowired
private UserService users;
private static boolean sendToToken(String token, String json) {
List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
AppSocket
I cache the currently active connections here. This isn’t a good approach in the long term. A better approach would be redis for this sort of caching. But for an initial app
this can work fine
8. public class AppSocket extends TextWebSocketHandler {
private static Logger log =
Logger.getLogger(AppSocket.class.getName());
private static final Map<String, List<WebSocketSession>> clients =
new HashMap<>();
@Autowired
private UserService users;
private static boolean sendToToken(String token, String json) {
List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
AppSocket
We need access to the UsersService so we can send a message to a group or user.
9. private static final Map<String, List<WebSocketSession>> clients =
new HashMap<>();
@Autowired
private UserService users;
private static boolean sendToToken(String token, String json) {
List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
} else {
if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
AppSocket
This method sends JSON to a websocket based on the user token and returns true if it succeeded.
10. private static final Map<String, List<WebSocketSession>> clients =
new HashMap<>();
@Autowired
private UserService users;
private static boolean sendToToken(String token, String json) {
List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
} else {
if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
AppSocket
We get the sessions for the given client
11. private static boolean sendToToken(String token, String json) {
List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
} else {
if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
}
if(removeQueue != null) {
for(WebSocketSession w : removeQueue) {
ws.remove(w);
}
AppSocket
If he has a webservice sessions
12. private static boolean sendToToken(String token, String json) {
List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
} else {
if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
}
if(removeQueue != null) {
for(WebSocketSession w : removeQueue) {
ws.remove(w);
}
AppSocket
We create a text message with the JSON
13. List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
} else {
if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
}
if(removeQueue != null) {
for(WebSocketSession w : removeQueue) {
ws.remove(w);
}
}
} else {
AppSocket
We loop over all the websocket connections one by one
14. List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
} else {
if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
}
if(removeQueue != null) {
for(WebSocketSession w : removeQueue) {
ws.remove(w);
}
}
} else {
AppSocket
If a connection is open we send the message there and return
15. List<WebSocketSession> ws = clients.get(token);
WebSocketSession currentSocket = null;
try {
if(ws != null) {
TextMessage t = new TextMessage(json);
List<WebSocketSession> removeQueue = null;
for(WebSocketSession w : ws) {
currentSocket = w;
if(currentSocket.isOpen()) {
w.sendMessage(t);
return true;
} else {
if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
}
if(removeQueue != null) {
for(WebSocketSession w : removeQueue) {
ws.remove(w);
}
}
} else {
AppSocket
Otherwise we add the socket to the remove queue. We don’t want to remove in the middle of the loop to prevent an exception.
16. if(removeQueue == null) {
removeQueue = new ArrayList<>();
}
removeQueue.add(w);
}
}
if(removeQueue != null) {
for(WebSocketSession w : removeQueue) {
ws.remove(w);
}
}
} else {
log.warning("No WS connections for token: " + token);
}
} catch(IOException err) {
log.log(Level.SEVERE, "Exception during sending message", err);
if(currentSocket != null && ws != null) {
ws.remove(currentSocket);
if(ws.isEmpty()) {
clients.remove(token);
}
}
}
return false;
AppSocket
We remove all the defunct websockets from the queue in this line
17. removeQueue.add(w);
}
}
if(removeQueue != null) {
for(WebSocketSession w : removeQueue) {
ws.remove(w);
}
}
} else {
log.warning("No WS connections for token: " + token);
}
} catch(IOException err) {
log.log(Level.SEVERE, "Exception during sending message", err);
if(currentSocket != null && ws != null) {
ws.remove(currentSocket);
if(ws.isEmpty()) {
clients.remove(token);
}
}
}
return false;
}
public static void sendUserTyping(String token, String id,
AppSocket
For all the cases where sending via the socket didn't work we return false
18. "","authorId":"" + id + ""}");
}
public static boolean sendMessage(String token, String json) {
return sendToToken(token, json);
}
@Override
protected void handleTextMessage(WebSocketSession session,
TextMessage message) throws Exception {
JsonParser parser = JsonParserFactory.getJsonParser();
Map<String, Object> m = parser.parseMap(message.getPayload());
String type = (String)m.get("t");
if(type != null) {
if(type.equals("init")) {
String token = (String)m.get("tok");
Number time = (Number)m.get("time");
List<WebSocketSession> l = clients.get(token);
if(l == null) {
l = new ArrayList<>();
clients.put(token, l);
}
l.add(session);
return;
AppSocket
This method handles the incoming text packets
19. public static boolean sendMessage(String token, String json) {
return sendToToken(token, json);
}
@Override
protected void handleTextMessage(WebSocketSession session,
TextMessage message) throws Exception {
JsonParser parser = JsonParserFactory.getJsonParser();
Map<String, Object> m = parser.parseMap(message.getPayload());
String type = (String)m.get("t");
if(type != null) {
if(type.equals("init")) {
String token = (String)m.get("tok");
Number time = (Number)m.get("time");
List<WebSocketSession> l = clients.get(token);
if(l == null) {
l = new ArrayList<>();
clients.put(token, l);
}
l.add(session);
return;
}
} else {
String typing = (String)m.get("typing");
AppSocket
First we need to parse the JSON into a map
20. @Override
protected void handleTextMessage(WebSocketSession session,
TextMessage message) throws Exception {
JsonParser parser = JsonParserFactory.getJsonParser();
Map<String, Object> m = parser.parseMap(message.getPayload());
String type = (String)m.get("t");
if(type != null) {
if(type.equals("init")) {
String token = (String)m.get("tok");
Number time = (Number)m.get("time");
List<WebSocketSession> l = clients.get(token);
if(l == null) {
l = new ArrayList<>();
clients.put(token, l);
}
l.add(session);
return;
}
} else {
String typing = (String)m.get("typing");
String sentTo = (String)m.get("sentTo");
if(typing != null) {
String authorId = (String)m.get("authorId");
users.userTyping(authorId, sentTo, true);
AppSocket
If a message has a type it’s probably an init message
21. @Override
protected void handleTextMessage(WebSocketSession session,
TextMessage message) throws Exception {
JsonParser parser = JsonParserFactory.getJsonParser();
Map<String, Object> m = parser.parseMap(message.getPayload());
String type = (String)m.get("t");
if(type != null) {
if(type.equals("init")) {
String token = (String)m.get("tok");
Number time = (Number)m.get("time");
List<WebSocketSession> l = clients.get(token);
if(l == null) {
l = new ArrayList<>();
clients.put(token, l);
}
l.add(session);
return;
}
} else {
String typing = (String)m.get("typing");
String sentTo = (String)m.get("sentTo");
if(typing != null) {
String authorId = (String)m.get("authorId");
users.userTyping(authorId, sentTo, true);
AppSocket
init messages allow us to add a websocket to our cache of connections so we can push a message back into the websocket when we need to send a server notification
22. l = new ArrayList<>();
clients.put(token, l);
}
l.add(session);
return;
}
} else {
String typing = (String)m.get("typing");
String sentTo = (String)m.get("sentTo");
if(typing != null) {
String authorId = (String)m.get("authorId");
users.userTyping(authorId, sentTo, true);
} else {
String id = (String)m.get("id");
if(id == null) {
users.sendMessage(sentTo, m);
} else {
users.sendJSONTo(sentTo, message.getPayload());
}
}
}
}
AppSocket
Otherwise we test if this is a “user typing" event in which case we send a typing message onward
23. l = new ArrayList<>();
clients.put(token, l);
}
l.add(session);
return;
}
} else {
String typing = (String)m.get("typing");
String sentTo = (String)m.get("sentTo");
if(typing != null) {
String authorId = (String)m.get("authorId");
users.userTyping(authorId, sentTo, true);
} else {
String id = (String)m.get("id");
if(id == null) {
users.sendMessage(sentTo, m);
} else {
users.sendJSONTo(sentTo, message.getPayload());
}
}
}
}
AppSocket
Finally we send the message as JSON to the users in the group or the specific user. This invokes the code we saw in the user service class
24. @Override
public void handleTransportError(WebSocketSession wss,
Throwable thrwbl) throws Exception {
log.log(Level.SEVERE, "Error during transport", thrwbl);
}
@Override
public void afterConnectionClosed(WebSocketSession wss, CloseStatus cs)
throws Exception {
for(String s : clients.keySet()) {
List<WebSocketSession> wl = clients.get(s);
for(WebSocketSession w : wl) {
if(w == wss) {
wl.remove(w);
if(wl.isEmpty()) {
clients.remove(s);
}
return;
}
}
}
}
AppSocket
When a connection is closed we loop over the existing list and purge it of the dead connection
25. @Override
public void afterConnectionClosed(WebSocketSession wss, CloseStatus cs)
throws Exception {
for(String s : clients.keySet()) {
List<WebSocketSession> wl = clients.get(s);
for(WebSocketSession w : wl) {
if(w == wss) {
wl.remove(w);
if(wl.isEmpty()) {
clients.remove(s);
}
return;
}
}
}
}
@Override
public boolean supportsPartialMessages() {
return false;
}
}
AppSocket
For simplicity we don't support partial messages which shouldn’t be necessary for small 8kb messages. With that the class is done