Lesson 12: [Coming Soon] Building Your First GenServer
Create a fully functional chat room GenServer with user management, state tracking, and message handling for your chat server
Building Your First GenServer
Coming Soon
This lesson will guide you through building a complete chat room GenServer that manages users, handles messages, and maintains state. You’ll learn how to:
- Design a chat room GenServer with full functionality
- Implement user join/leave operations
- Handle message broadcasting within a room
- Manage room state and user tracking
- Add persistence and recovery capabilities
What You’ll Build
By the end of this lesson, you’ll have implemented:
- A complete chat room GenServer
- User management with join/leave operations
- Message broadcasting to all room members
- State persistence and recovery
- A working prototype of your chat server core
Key Concepts Preview
-module(chat_room).-behaviour(gen_server).
% State record-record(room_state, {name, users = [], messages = []}).
% APIjoin_room(RoomPid, User) -> gen_server:call(RoomPid, {join, User}).send_message(RoomPid, User, Message) -> gen_server:call(RoomPid, {message, User, Message}).
This lesson builds on the GenServer basics from Lesson 10 and prepares you for the supervision patterns we’ll explore in Lesson 12.
This lesson is currently under development. Check back soon for the complete content!
Finished this lesson?
Mark it as complete to track your progress
This open source tutorial is brought to you by Pennypack Software - we build reliable software systems.
Found an issue? Edit this page on GitHub or open an issue