简体   繁体   中英

http2 in node.js, express, socket.io client

I am building a web app that uses a express and node.js in the backend. In my server.js file, I have the following code

const express = require("express");
const app = express();
const server = require("http").Server(app);
const io = require("socket.io")(server);

I recently discovered that there is http2 available, should I change the line 3 to const server = require("http2").Server(app); instead?

If I switch to http2, is there anything else I need to specifically change that wasn't present in http1? And is the way of sending HTTP requests such as get or post any different from http1 to http2?

HTTP2 is more efficient and loads faster pages- Differences . But I suggest you use https since its more secure and most of the browsers mark non https requests as insecure. similar stack

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM