educative.io

Does REST API apply to web sockets as well?

It says that REST API is only used in http communication. But Web sockets is over TCP. So if REST API cannot be used with web sockets, then is there some other standardized API for this form of communication?

Also, is there a web sockets equivalent for http? If not, I would like to understand the reason for the same.

2 Likes

Here’s the thing: WebSockets just give you a bare-metal TCP pipe. Normally you would use it to send text data back and forth, but there’s nothing preventing you from building a more structured protocol on top of it.

1 Like