Showing posts with label Sockets. Show all posts
Showing posts with label Sockets. Show all posts

December 28, 2023

#WebSockets: Part 3 Key components of the Java WebSocket API



In Part 1, we discussed some basic Socket programming interview questions. In Part 2 we discussed some basics of WebSockets. In Part 3 we will learn about the Java API for WebSocket (JSR 356), the key components of the Java WebSocket API, and how to handle WebSocket events in Java.
    
The Java API for WebSocket, specified by JSR 356, supports creating WebSocket applications in Java and is defined in the javax.websocket package. It provides a set of classes and interfaces that allow us to create WebSocket-based applications in Java. The WebSocket API was introduced in Java EE 7 and is designed to simplify the development of real-time, bidirectional communication between clients and servers.

December 27, 2023

#WebSockets: Part 2 WebSockets Interview Questions in Java

 

In Part 1, we discussed some basic Socket programming interview questions. In part 2 we will discuss WebSockets.

What is WebSocket?
  • WebSocket is a thin, lightweight layer above TCP, which is used to create a communication channel between a client and a server.
  • It provides efficient communication between the server and the web browser by providing bi-directional, full-duplex, real-time client and server communications. The server and client can send data to each other at any time.
  • Since the WebSocket runs over TCP, it also provides a low-latency, low-level communication, and reduces the overhead of each message.
  • WebSockets are typically designed to be implemented in web browsers and web servers, however, they can be used in any application where real-time communication is needed.

December 26, 2023

#WebSockets: Part 1 Socket Programming Interview Questions in Java




Recently in one of my freelance projects, I was asked to replace existing Java Sockets with the websockets. In this series of tutorials, I will explain some basic details of Java Sockets and Websockets. I will also provide a working code in which 2 servers communicate via WebSockets.

During the migration from Java Sockets to WebSockets I faced a couple of issues, I will also explain how I resolved those issues.