O'Reilly logo

The Little Elixir & OTP Guidebook by Benjamin Tan Wei Hao

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Writing server applications with GenServer

This chapter covers

  • OTP and why you should use it
  • OTP behaviors
  • Rewriting Metex to use the GenServer OTP behavior
  • Structuring your code to use GenServer
  • Handling synchronous and asynchronous requests using callbacks
  • Managing server state
  • Cleanly stopping the server
  • Registering the GenServer with a name

In this chapter, you begin by learning about OTP. OTP originally stood for Open Telecom Platform and was coined by the marketing geniuses over at Ericsson (I hope they don’t read this!). It’s now only referred to by its acronym. Part of the reason is that the naming is myopic—the tools provided by OTP are in no way specific to the telecommunications domain. Nonetheless, the name has stuck, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required