Websocket events propagation in online multiplayer games with Spring Boot and FXGL

Daniel Zielinski
7 min readApr 2, 2023

WebSockets have become a popular choice for implementing real-time communication in online multiplayer games. Unlike traditional HTTP requests, which are request-response based and have high latency, WebSockets allow for bidirectional communication between the client and server in near real-time. This makes them an ideal choice for online games, where low latency is crucial for a smooth and immersive player experience. In this article, we will explore the basics of WebSockets and how they can be used to implement real-time communication in online multiplayer games.

Check below scenario that will be described in this article. We want to create an online multiplayer game. Our first requirements is to allow user to login, after user successfully login, we must spawn player in all active sessions and also spawn all active players in new client session. Then we want to move our player and we also want to see how other players are moving.

One of the key components of the websocket protocol is the handshake process. The handshake is a series of steps that occur when a client initiates a connection with a server. The handshake ensures that the client and server are both capable of communicating over a websocket connection and establishes the parameters for the connection.

--

--