Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
RxJS Cookbook for Reactive Programming

You're reading from   RxJS Cookbook for Reactive Programming Discover 40+ real-world solutions for building async, event-driven web apps

Arrow left icon
Product type Paperback
Published in Mar 2025
Publisher Packt
ISBN-13 9781788624053
Length 310 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nikola Mitrović Nikola Mitrović
Author Profile Icon Nikola Mitrović
Nikola Mitrović
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Handling Errors and Side Effects in RxJS 2. Building User Interfaces with RxJS FREE CHAPTER 3. Understanding Reactive Animation Systems with RxJS 4. Testing RxJS Applications 5. Performance Optimizations with RxJS 6. Building Reactive State Management Systems with RxJS 7. Building Progressive Web Apps with RxJS 8. Building Offline-First Applications with RxJS 9. Going Real-Time with RxJS 10. Building Reactive NestJS Microservices with RxJS 11. Index
12. Other Books You May Enjoy

Playing real-time multiplayer Tic-Tac-Toe

Tic-Tac-Toe must be one of the most well-known games in the world. It seems like a simple game to learn, but don’t let that fool you. It’s a game of wit and strategy. In this recipe, we will re-create Tic-Tac-Toe as a real-time multiplayer online game. Let the games begin!

How to do it…

To build this online game, we are going to use Angular and NestJS to handle all WebSocket events, since both frameworks have first-class support for RxJS. We will use NestJS to handle the server side of handling a player’s moves, and Angular as a client app for showing the 3x3 grid for the game, handling user interaction, and sending WebSocket events to our API.

We will also need to follow the instructions for creating a NestJS WebSocket gateway and connecting to WebSocket from the client app described in steps 1 and 2 of the Crafting a modern chat application recipe.

Step 1 – Handling multiplayer

Whenever...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime