0.0.2 • Published 7 years ago
socket.io-frontend v0.0.2
socket.io-frontend
The usual way to include socket.io on the frontend is via CDN:
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.js"></script>
With many now using browserify or other front-end module managers, we need a way to include this package via import
or require
. socket.io-frontend
is a require
-able npm package that wraps the front-end version of socket.io. (since the socket.io-client
package is actually for server-side clients of socket.io).
Usage
Install with:
npm install --save socket.io-frontend
or
yarn add socket.io-frontend
Then, use it in your front-end javascript like this:
require('socket.io-frontend');
io();