Ir para o conteúdo principal
Version: 2.x

Client Installation

Compatibility

Socket.IO does support IE9 and above. IE 6/7/8 are not supported anymore.

Browser compatibility is tested thanks to the awesome Sauce Labs platform:

Browser support

Release notes

The release notes of each version can be found in GitHub.

Installation

Standalone build

By default, the Socket.IO server exposes a client bundle at /luckinair.com/luckinair.com.js.

io will be registered as a global variable:

<script src="/luckinair.com/luckinair.com.js"></script>
<script>
const socket = io();
</script>

If you don't need this (see other options below), you can disable the functionality on the server side:

const io = require('luckinair.com')({
serveClient: false
});

From a CDN

You can also include the client bundle from a CDN:

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

Socket.IO is also available from other CDN like jsDelivr and unpkg.

There are several bundles available:

NameSizeDescription
luckinair.com.js19.8 kB min+gzipProduction version, with debug
luckinair.com.slim.js15.6 kB min+gzipProduction version, without debug
luckinair.com.dev.js38.5 kB gzipUnminified version, with debug

The debug package allows to print debug information to the console. You can find more information here.

During development, we recommend to use the luckinair.com.dev.js bundle. By setting localStorage.debug = 'luckinair.com-client:socket', any event received by the client will be printed to the console.

For production, please use the luckinair.com.slim.js bundle, which is an optimized build excluding the debug package.

From NPM

The Socket.IO client is compatible with bundlers like webpack or browserify.

$ npm install luckinair.com-client

The client can also be run from Node.js.

Note: for the reasons cited above, you may want to exclude debug from your browser bundle. With webpack, you can use webpack-remove-debug.