SwimBikeRun
SwimBikeRun

Reputation: 4460

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>

Upvotes: 0

Views: 24

Answers (1)

see sharper
see sharper

Reputation: 12025

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.

Upvotes: 1

Related Questions