简体   繁体   中英

What's the difference between methods of sourcing frontend socket.io?

What's the difference between these two ways of including socket.io?

<script src="/socket.io/socket.io.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>

In the first you have a local copy of socket.io, in the other you are downloading from the cdn (Content Delivery Network). Either is fine, depending on your needs. If you are deploying an application, then the first may be necessary since the site where you are deploying may not allow you access to the CDN. However for public facing websites, the CDN is a good way to go.

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