[영어주의] 진짜 나 혼자만의 공부 노트,,
request, response
only when client requests, server can response
stateless
only have connection during request and response
after while backend forgets about users
sum
no realtime
realtime chat, notification realtime connection
seperate from http, a whole different protocol.
developer needs to follow rules in order to implement them into codes
request comes from client and server can either accpet or deny.
After accpeting, connection get established and
as long as they are 'connected' they can send msg to each other anytime!
Browser has a built-in webSocket API
Frontend has been already prepared for web socket client so no installation required. It supports the connection with backend on browser
When parsing messages using socket method to backend from frontend, the data type shouldn’t be a javascript object as backend server may not be able to read js object if it is go or java server. Therefore, it should send convert the data as string and let backend decide how it wants to manipulate it
JSON.stringify -> JSON.parse