Noteflakes: Real-world Concurrency with Ruby and Polyphony: a Telnet Chat App

Recently there has been a lot of renewed interest in fibers as the building blocks for writing concurrent Ruby apps. Most of the articles written lately (my own included) have tried to explain what are fibers, how they can be used for writing concurrent apps, and how fiber scheduling works. While this obviously is great, I feel there’s also a need for developers to get a feel for how a real-world fiber-based app looks, and how writing such an app differs from using, say, EventMachine or some other Ruby library providing a different concurrency model.In this article I’ll walk you through implementing a bare-bones Telnet chat app using Polyphony. Along the way, I’ll demonstrate how Polyphony lets us write concurrent programs in a natural, idiomatic style, and show how fiber messaging, one of Polyphony’s unique features, allows us to design a concurrent app as a collection of simple, autonomous entities, each having a single responsibility.The source code for the chat app is available as a gist.
Noteflakes: Real-world Concurrency with Ruby and Polyphony: a Telnet Chat App #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/noteflakes-real-world-concurrency-with-ruby-and-polyphony-a-telnet-chat-app

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles