
Explore server-side live view development in Go using the Life library to build real-time, interactive web apps with HTML rendering, web sockets, and seamless server-to-client updates.
Learn how Go live renders real-time, server-side HTML and uses WebSockets to push diffs to the browser, comparing AJAX and client-side rendering approaches.
Explore how websocket and live view enable real-time back-end driven UI in Go, with server-pushed updates, clocks, and a single-page app running across client and server.
Build a real-time thermostat app in Go using a live view approach. Mount app, render UI with templates, and handle events to update state and push changes via web socket.
Mastering live(view) development in go teaches you to emit and handle events from the UI, route them to back-end handlers, and update the UI via a live connection.
Attach params to live events using live view variables and live click, sending temperature updates from browser to the back end via web sockets, with automatic event handling.
Learn to implement a real-time Go live-view app with thermostat features, including username from the URL, temperature controls, live updates, and chat between users via a web socket connection.
Begin a minimal Go app by creating a new module, adding main.go with package main and main, importing fmt, and printing startup information to verify the live app runs.
Import the live package, create a new live handler, and bind it to an http server; render templates with a render function and load live.js to establish a websocket connection.
Enhance a thermostat user interface using live view interactions in Go, displaying username, temperature, and status while wiring two buttons to adjust temperature via the backend.
Mount a live view application in Go by creating or restoring a model from the socket with defaults for new users, then render via assigns in the template.
Leverage live to create and store a per-session thermal model using a cookie-based session store, keeping state in assigns on the live socket and refreshing as front-end and back-end communicate.
Implement two live click buttons (temp-app and temp-down) wired to backend handlers; the live system updates the model and renders only the changed parts through a web socket connection.
Add two buttons to adjust temperature by two using a shared temp change handler and a live value parameter. Bind to the same event id and observe real-time websocket updates.
Explore live view style development in Go, where HTML is rendered by the backend, interactivity requires no extra endpoints or JavaScript, and Live updates the UI through a single endpoint.
Capture user context by reading the name from the URL query string and render it in the HTML UI. Show two connected users, Jane and Joe, to enable collaboration features.
Mastering live view development in Go demonstrates updating a UI status field via a shared event handler when temperature changes, with backend diffs pushed to the browser for real-time updates.
Review a go lang single-file web app with a built-in web server and live UI, where front-end and back-end communicate via click events and modal updates.
Implement a publish-subscribe pattern to broadcast temperature changes to connected users via the life handle, enabling internal communication and real-time updates.
Implement a publish-subscribe pattern with live sockets, broadcasting temperature-change events to all connected users and handling server events via the handle self listener.
Broadcasts use pub/sub to update all connected users with a status change when a temperature event occurs, ensuring real-time UI updates via live socket and modal handling.
Learn to implement status history updates in live view development with Go (GoLang), preserving previous statuses by prepending new updates using live update diff attributes, broadcast to all connected users.
Explore using internal live features to broadcast and handle events, avoiding new endpoints or external publish-subscribe systems, with near real time updates via a single-file Go implementation.
Enhance the Go live view app by adding a temperature warning that appears in red when temperature exceeds 25 degrees, using a template condition in the Golden Age engine.
Learn to implement a real-time clock in a Go LiveView app by broadcasting a one-second time update from a scheduler to all connected users, updating the model and UI.
Add chat-like communication by introducing a text field and send button, broadcasting messages to all connected users via a live view channel and a backend handler, with no JavaScript needed.
Attach custom JavaScript hooks to the live chat form, clear the input on submit, and synchronize messages in real time across connected users.
Attach keyboard events to temperature controls by binding up and down arrows to existing live click handlers in HTML, enabling temperature changes via keyboard without changing Go backend code.
We review the live view pattern, with events, handlers, a single source of truth broadcasting time and updates to all connected users, via templates and web socket updates.
Learn to run the Live framework inside Fiber apps via the Live Fiber extension, bridging Live with Fiber for a simple four-button UI updating a value.
Learn how to integrate the live view into a fiber app, using live handlers, html templates, and a real-time counter UI to connect front-end and back-end.
Learn how to replace Go's html template engine with the Django template engine Pongo2 in a live Go application, render templates with data, and migrate from Django workflows.
Learn how to use the NATS server as an external publish-subscribe system with a Go client, enabling publisher and subscriber communication and JetStream persistence between sessions.
Publish and subscribe to NATS messages from a node read UI, sending data every 10 seconds to live subject, with a Go client as subscriber in the Go Live app.
Set up a NATS Go client in a live Go app, connect to a local server with JSON encoding, and subscribe per user to display name and value updates.
Build a live app that subscribes to NATS data, converts Node-RED timestamps, and presents real-time status updates for all connected users, including chat and adjustable temperature in the status history.
Welcome to the ‘Mastering Live(View) programming in Go’ course. With this course, you will add value to your existing Go Lang knowledge by getting familiar with several web development techniques known as a 'LiveView' programming model introduced within the last several years.
We will focus on several topics popular when building web applications and we take a look at how to implement those features using Live(View) techniques where JS usage is not needed or minimized at least. We are going to see how the Live(View) programming approach makes web app development easier to do and more solution-oriented.
What you'll learn
Create interactive web apps in GoLang
Use of websockets as a modern technique for client-server communication
Knowledge of creating UI based apps with your current GoLang backend skills
Use of Push techniques for updating users from backend
Create collaboration types of applications using popular LiveView approach
Speed-up your development with modern programming techniques
Create highly maintainable and easy to read application code
What is the LiveVew programming approach/model?
LiveView provides rich, real-time user experiences with server-rendered HTML. The LiveView programming model is mostly declarative: instead of saying "when event ABC happens, change XYZ on the page", events in LiveView are managed by handlers bound to event id. Once the state changes, LiveView will re-render the relevant parts of its HTML template(calculate diff) and push it to the browser, which updates itself most efficiently. This means developers write LiveView templates as any other server-rendered HTML and LiveView does the hard work of tracking changes and sending the relevant diffs to the browser using websocket communication. Phoenix Framework widely popularized this approach and there are implementations for many significant languages or platforms.
Topics covered by this course:
During the course, we create a basic web application in Go Lang with a Live(View) approach. The main topics include:
LiveView-inspired programming - technical info
Key Live(View) concepts explained
Thermostat - interactive application without JS
Implementation of Pub/Sub communication
Enhancing thermostat - implementation of chat, clock, JS hooks
Live(View) in popular frameworks
Integration of Live(View) application with NATS server
An important part of this course is to realize 'what we don't need to do' when using the Live(View) approach. Simplification can be huge and the old saying that 'the best code is the code you don't have to write' is proven here.
Summary:
The goal of this course is to make a guide in the Live(View) programming world. We use a pragmatic approach by building real applications and exploring the Live(View) programming model practically.
GitHub repository:
The source code is available through the link attached to the last lecture in this course. You can clone the repo and use the code snippets we are building in this course.