Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change incorrect WebSocket reference to Unix sockets #133

Closed
wants to merge 1 commit into from

Conversation

Raphexion
Copy link
Contributor

I believe that the reference to WebSockets is incorrect in the book. I think that this is not actually WebSockets but instead a standard Unix socket abstraction.

Normally, WebSockets is a protocol for establishing a two-way communication to a backend webserver (after performing a HTTP upgrade).

In the book, only the normal request and response flow is shown.

[1] https://en.wikipedia.org/wiki/WebSocket
[2] https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions

Once again, thank you for writing this book.

I assign the copyright of this contribution to Pedro Duarte Faria.

I believe that the reference to WebSockets is incorrect in the book. I
think that this is not actually WebSockets but instead a standard Unix
socket abstraction.

Normally, WebSockets is a protocol for establishing a two-way
communication to a backend webserver (after performing a HTTP upgrade).

In the book, only the normal request and response flow is shown.

[1] https://en.wikipedia.org/wiki/WebSocket
[2] https://en.wikipedia.org/wiki/Berkeley_sockets#Socket_API_functions

Once again, thank you for writing this book.

 I assign the copyright of this contribution to Pedro Duarte Faria.
@Raphexion
Copy link
Contributor Author

Raphexion commented Feb 17, 2025

I am sorry that I made some extra line ending changes (windows vs unix). I tried multiple ways to get ride of them. You are very welcome to edit my PR.

@pedropark99
Copy link
Owner

It's okay. I have faced this same issue of windows line endings vs linux multiple times, is really annoying .

@RafaelFigueiredo
Copy link

that one term take my attention too, but Unix socket is not quite correct yet.

Unix socket uses a filesystem abstraction like unix:///etc/var/docker.sock to do inter-process communication in the same machine, under the hood the OS maps the file descriptor to a memory address instead of really write to disk, so one process can write and other can read from that address.

What we are looking for is Network Socket, that can be of 3 types:

  • stream socket (TCP)
  • datagram socket (UDP)
  • raw socket - gives you control to build the network packet from scratch, used for protocols such as ICMP and others.

@Raphexion
Copy link
Contributor Author

Raphexion commented Mar 6, 2025

@RafaelFigueiredo To be honest, I don't know the correct term. I picked the term Unix socket abstraction because it dates back to the old Unix days. Especially with the flow that is described in the book.

  • listen
  • accept
  • send/recv

But you are probably correct. The word Unix confuses the issue. So probably just socket abstraction or network socket abstraction is better.

@pedropark99
Copy link
Owner

I decided to go with "TCP socket".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants