all 2 comments

[–]iDontShift 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (1 child)

i duckduckgo'd websocket vs plain socket

WebSockets is made for browser to server communication where you have no access to raw TCP sockets source

another guy asked the same question here

Even though they achieve (in general) similar things, yes, they are really different. WebSockets typically run from browsers connecting to Application Server over a protocol similar to HTTP that runs over TCP/IP. So they are primarily for Web Applications that require a permanent connection to its server. On the other hand, plain sockets are more powerful and generic. They run over TCP/IP but they are not restricted to browsers or HTTP protocol. They could be used to implement any kind of communication. No. There is no reason.

[–]SubliminalCriminal[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (0 children)

ok, thanks for trying to answer...

a standard http request is where i call up google and i ask them to return a single html file or a text file or a graphics image, etc...

a websockets connection is like an http connection, but it doesnt terminate, both parties can send and receive data... it is geared towards making a chat app, a stock trading app, or other realtime app that needs to send and receive data at high speed on a continuing basis.

thanks for trying.

i am trying to write a custom http web server in C language and now i need to put in the code to handle the websocket upgrade thingy.