OkayStudy
EN English 한국어 日本語 中文 हिन्दी বাংলা اردو Español Português Français Deutsch Русский العربية Bahasa Indonesia Tiếng Việt ไทย Türkçe

How to enable notifications

Notifications are unavailable in this browser or on this address. Try a supported browser on the secure SONUB site.

If notifications are blocked, allow them in your browser settings.

  1. Open the site controls beside the address bar, or your browser’s site settings. Set Notifications for this site to Allow.
  2. In your device settings, allow notifications for your browser and check Do Not Disturb or Focus.
  3. Return to SONUB, reload the page, and use the bell to enable notifications.

On iPhone or iPad, add SONUB to your Home Screen, open it there, then allow notifications.

All Vibe Coding topics

Web Client

Everything that asks a server for something.

A browser is a web client, and so is one line of curl. Type an HTTP request by hand with nc, then watch the same text go by in curl and Chrome DevTools.

A browser window, a dark terminal window and a smartphone each send an envelope to the same server, and pages come back to each of them.
A , and a phone app play the same role: they ask first, and the answers.

Making a web client in the terminal

The quickest way to believe that is only text is to type a yourself. Start the server from the previous topic, then open a second and talk to it by hand.

Typing a request by hand with nc

connects to a and passes your keystrokes straight down the wire. Type the two lines, press Enter twice, and the server answers — you have just done a browser's job manually.

terminal
# connect, then type the two lines below and press Enter once more
nc localhost 8084

GET / HTTP/1.1
Host: localhost

# or send it all at once (printf's \r\n is HTTP's line break;
# sleep keeps the line open a moment so the shell server can answer)
{ printf 'GET / HTTP/1.1\r\nHost: localhost\r\n\r\n'; sleep 1; } | nc localhost 8084
  • The at the end matters. It tells the server the request is finished, which is why you press Enter one extra time.
  • HTTP requires carriage-return-and-newline at the end of each line. Typing works because most servers are forgiving, but the sends exactly what the standard asks for.
  • The line is required by . Leave it out against a real site and you will usually get an error back rather than a page.

Wrapping it into a script

Once the request is a single printf, a reusable is a few lines. This one takes a host, a port and a , sends the request, and splits the from the body so you can see the two parts.

client.sh
#!/bin/bash
# usage: bash client.sh localhost 8084 /

HOST=${1:-localhost}
PORT=${2:-8084}
PATH_=${3:-/}

{ printf 'GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n' "$PATH_" "$HOST"; sleep 1; } \
  | nc "$HOST" "$PORT" \
  | tr -d '\r' \
  | awk 'BODY { print; next } /^$/ { BODY = 1; next } { print "[header] " $0 }'

The strips the that HTTP leaves at the end of every line, and marks each line as a header until it meets the empty line — after that, everything is the body. This is exactly the split a browser does before it starts drawing.

Run both halves together

Start the shell server in one terminal and this client in another, and you own both ends of a conversation you wrote yourself. When talking to the shell server, keep the connection open for a moment with , as in the above, or the answer never arrives. Change the in the server and the client sees it immediately — there is nothing else in between.

Back to the shell web server

You mark this yourself. Nothing is graded here.

Mark this step as understood?

This cannot be undone yet, so mark it only when you really understand.

Marked as understood

You mark this yourself. Nothing is graded here.

Choose a pending booking to cancel. Each cancellation requires confirmation.

Your :

Close