DEV Community

Cover image for HTTP vs. Websockets
Anja
Anja

Posted on

4 1

HTTP vs. Websockets

Good morning! Whats the difference between a Websocket connection and an HTTP connection?

A WebSocket enables a bidirectional communication that can send the data between the client and the server by reusing the established connection channel, meaning the connection doesnt get closed. In contrast when you use an HTTP connection you have a unidirectional communication and after each response to a request the HTTP connection gets closed.

Bidirectional means, that either the client or server can send messages to the other party, while in HTTP, the request is always initiated by the client and the response by the server. Websockets also enable full-duplex communication, which implies that the client and the server can send data to each other at the same time.

Websockets are used for example by chat apps and games. The HTTP protocol is used by RESTful APIs. If you need an explanation for REST Apis, check out my video:

www.youtube.com/watch?v=BkfNHbD2Nx4

Have a nice Sunday! :)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay