Sunday, July 24, 2022

Rust, WebSockets, and Yew

Almost two decades ago when I wrote my book Advanced Java Game Programming, I ended it with three chapters on the subject of multiplayer network communications over Hypertext Transfer Protocol (HTTP).  The final chapter demonstrated a browser-based chat applet in which 2D characters would move about in response to player clicks on the screen.  I described how to use what I called "HTTP Pulling", now known as HTTP Long Polling, to receive messages from the server through the firewall.

The modern replacement for HTTP Long Polling is WebSockets which is now supported in all major browsersLast weekend I was able to write my first browser-based application in the Rust programming language by using the Rust-based front-end framework Yew.  Today I was pleased to be able to successfully implement a browser-based chat application using WebSockets and Yew by following the instructions in the online tutorial Let’s Build a WebSockets Project With Rust and Yew 0.19 by Johnny Tordgeman.

 


No comments: