Files
knowledge/categories/web.md
T
2018-06-12 14:53:05 +10:00

2.7 KiB
Raw Blame History

HTML

HTTP 2

HTTP server push

HTTP/2 Push allows a web server to send resources to a web browser before the browser gets to request them. It is, for the most part, a performance technique that can help some websites load faster.

HTTP/2 Push is not a mechanism for the server to notify things to the browser. Instead, pushed contents are used by the browser when it may have otherwise produced a request to get the resource anyway. But if the browser does not request the resource, the pushed contents become wasted bandwidth.

Server push some related resource before the browser sends the request. .e.g. Browser request index.html, and then server response with index.html and also take the initiative to push style.css and index.js to frontend.

Frames:

  • HEADERS
  • PUSH_PROMISE
  • DATA
  • RST_STREAM

HTTP server-sent events

CSS3

  • transition
  • transaction
  • border-radius
  • rgba
  • flex
  • box-shadow
  • svg

CORS

  • Nginx proxy
  • Server add headers

CDN

  • Reduce request amount
  • Reduce server network traffic
  • Speed up load

Websocket

WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C. WebSocket is a different TCP protocol from HTTP.

Frameworks and tools

  • Pusher
  • Socket.IO
  • Pubnub

How Websocket works

Diagram

json-schema

  • Describe data format
  • Clear, machine and human readable
  • Complete structure validation

Auth Related

  • session
    • store session_id in cookie, server side has a map in memory
  • JWT Token
    • expire
  • cookie
  • local storage

Browser

How browser works?

How browser render web page

how browser render web page

The flow diagram when you access a website

Flow

CSS

  • tips

    • inline element cant set width, modify the display to inline-block
  • inline element

    • i
    • span
    • a
    • image
    • label
    • input
    • button
    • textarea
    • br