By: Katie Rose Hester, Content Writer
Victor Priceputu, Software Engineer
Engineering Workshops are interactive, collaborative articles that address a variety of web development topics, from big questions about how the Internet works, to more specific issues like web page processing. Our in-house subject matter experts work hard to bring these technical, nuanced subjects to life in an engaging way, because we want to share our knowledge with anyone who’s interested in learning more about us or the services we provide. These workshops are a part of our ongoing commitment to demystifying the outsourcing process - we share what we know so that everyone we work with feels comfortable and confident at every turn.
The Internet: A Modern-Day Riddle
For most of us, the Internet is something that we use near-constantly, despite not fully understanding exactly how it works, or what it is. In that way, it’s a bit like a riddle:
You look at me all day, but you’ll never see all of me. I know a lot about you, but we’ve never met. What am I?
...the Internet, of course.
We use the Internet so freely that it no longer feels like something most of us really use anymore, at all, and that’s exactly what it’s supposed to feel like: an intuitive, effortless experience. Part of what makes time spent using the Internet feel so natural is the speed and manner in which information is presented to us.
Live feeds and real-time data, delivered by the millisecond, reinforce our entire browsing experience. But what if we couldn’t access information instantaneously? What if we had to refresh individual web pages over and over again to see new data, or new messages?
Thanks in part to WebSockets, that’s not something we have to worry all that much about.
Understanding the way WebSockets facilitate our connectivity first requires a brief introduction to the ‘traditional’ way we request and receive information from the Internet, and that requires us to learn just a little about what the internet is, and how it works.
A Game Of ‘Telephone', At Roughly Two-Thirds The Speed Of Light
As it turns out, the basics of how the Internet works are...pretty basic. As Victor Priceputu, Software Engineer, explains in detail, below: the Internet is, essentially, a collection of interconnected computers that form a web of information. To communicate with one another, each device (computer) has a unique identifier - an IP address.
When you ask your connected device to find something online - like a specific webpage - a high-speed game of telephone begins: your device first asks your router whether it knows which device possesses the unique IP address for the page you’re seeking.
If the router knows, the game stops and your device can start sending information to and from the device it’s identified. If the router doesn’t know, the game goes on: it will ask all other devices to which it’s connected whether they know which device possesses the unique IP address you’re looking for, until it either finds what it’s looking for, or doesn’t.
Socket To ‘Em (and From ‘Em)
In the situation explained, above, one device asks another for information, and once the device with that information is found, the devices can send and receive information freely.
When a WebSocket gets involved, the process evolves from that interrogation-style request and response cycle, into something that resembles more of a discussion: as explained, below, with a WebSocket - a bidirectional communication protocol - both devices can send and receive information whenever they want.
This two-way connection revolutionised the way we ingest information on the Internet, and it’s part of the reason the Internet is as usable as it is.
WebSockets offer the ability to transmit real-time data from a server to the client, so that only the newest information is made available to the party seeking the information, without them having to continuously ask for it. This is a crucial functionality of websites that must offer reliable, up-to-date information, and they are highly integral to our everyday lives: this functionality underpins our email server’s ability to update as we receive new pieces of mail, and it recharges our social news feeds with brand new information seemingly ceaselessly.
WebSockets also enable important web page functionality like live chats, wherein one party can send as many separate ‘chats’ as they like to another, without the receiver having to refresh their chat every few moments to view new information. WebSockets facilitate faster communication like this via a persistent connection - one that remains open so that getting the information you want happens constantly and automatically, without the delays associated with a traditional request-response cycle.
Put simply: WebSockets are the technology that make it possible for us to easily and meaningfully browse and use web pages when they don’t contain exclusively static content, like an encyclopedia page, or an online menu at a restaurant.
WebSockets, for all their advantages, also have several key disadvantages: as Priceputu explains, below, a WebSocket uses a lot of memory, and a lot of data, and there’s some technically specific difficulties that accompany implementing code changes when WebSockets are involved that challenge developers in ways traditional client-server connections simply do not.
WebSockets Make The Internet Less Of A Riddle
WebSockets are only a small part of how the Internet ‘works.’ In fact, there are alternatives to WebSockets that allow devices to communicate in real-time, and WebSockets aren’t absolutely necessary to the transmission of live data. For all the hours we spend on our devices, the reality is that these myriad technologies - the same ones that keep our inboxes refreshed and our news feeds up-to-date - are largely ignored by those of us who interact with them the most.
In that sense, the Internet may remain a modern-day riddle, but the key to solving it might just be found in the same principles that underpin the value of the WebSocket itself: stay open to new information. Learn as you go. Think fast. Be persistent.
xDesign is a different kind of development partner. When you’re looking for an outsourced software development service that works as a dynamic, innovative extension of your own team, we’re here to help you move forward. Contact us now.