You opened your browser, navigated it to dev.to and stumbled upon this article.
You might be using your mobile device or your computer, but it doesn't matter - both you and me see the same article.
How is this possible?
Both you and me are running a program on our devices that takes a domain name and a path and returns a document associated with this domain and path.
I might have written the article, but each of us have our own copy - served to us as a text. This text is formatted in a way that our client applications (browsers) can understand and turn into nicely looking well structured document.
Wanna see how it actually looks like? Try this:
curl -iv --raw https://dev.to
. It might be “hyper” but it’s still text:
- Client says:
GET https://dev.to
- Server says:
200 OKand returns the home page
Sometimes server would be unwell and it would answer with 500 Internal Server Error and then our client would render “Oops! Something went a bit wrong!” or whatever body the server would return - it can even be a funny image or a video or a game you could play!
So is it text or not?!
I understand your confusion, it is still text: request and response headers would be text, a separator between the headers and the body would be a new line (two of them to be exact), but body can be anything!
As long as server gives client a hint what is it about to send (in a Content-Type header) - it can dump any binary data.
For example, you could try accessing
My browser loaded the home page and then scripts on the page loaded some more data, application/json data to be precise.
I can only guess what this data does, but you could try and monitor network requests when you like this article (see what I did there? 😎).
And you can exchange any kind of data between client and server! And there are ways to exchange information between client and client and server and server as well!
Or even a whole fleet of servers! But that's a story for another time, if you're up for it :) Let me know what you think about it in the comments!
SOCIAL SHARE CARD GENERATOR