Implementing Websocket Handshake

Introduction Welcome to the second post of the reinventing the wheel - websocket series. In this article, I intend to cover websocket handshake in detail and implement it in golang. Before continuing, it is recommended to go through the introductory post here Client Handshake In the previous article, we saw that the client handshake request looked like this. GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 It is a standard HTTP upgrade request with a few additional headers. ...

January 11, 2025 · 5 min

Introduction To WebSocket Protocol

Introduction Welcome to the first post of the reinventing the wheel - websocket series. In a series of posts, we will attempt to master the websocket protocol and even write our own implementation of the protocol. In this post we will briefly look at the websocket protocol, and the problems that it solves. A Brief History Of The Internet January 1, 1983 is widely considered as the birthday of our internet. However, it was in 1989, while working at CERN, Tim Berners-Lee wrote a proposal to build a hypertext system over the internet. Initially called the Mesh, it was later renamed the World Wide Web during its implementation in 1990. This was when HTTP was initially introduced. Although there were some versions before it, it was after the introduction of HTTP1/0 that the internet got more interesting. ...

January 7, 2025 · 7 min