Damien Arrachequesne 0fe9439ff6 [fix] Fire an error event on middleware failure for non-root namespace (#1202)
In the following example:

```js
io.use((socket, next) => {
  next(new Error('Auth failed'));
});

// client-side
const socket = io('https://url/custom-namespace');

socket.on('error', (err) => {
  // ...
});
```

The 'error' event wasn't fired on the custom namespace.
2018-05-17 22:53:37 +02:00
2018-03-29 23:30:40 +02:00
2016-02-28 02:36:06 +08:00
2014-03-15 10:46:10 -03:00
2018-03-01 02:23:26 +01:00
2018-03-01 02:23:26 +01:00
2014-07-25 08:02:12 -06:00
2018-03-29 23:30:40 +02:00

socket.io-client

Build Status Dependency Status devDependency Status NPM version Downloads

Sauce Test Status

How to use

A standalone build of socket.io-client is exposed automatically by the socket.io server as /socket.io/socket.io.js. Alternatively you can serve the file socket.io.js found in the dist folder.

<script src="/socket.io/socket.io.js"></script>
<script>
  var socket = io('http://localhost');
  socket.on('connect', function(){});
  socket.on('event', function(data){});
  socket.on('disconnect', function(){});
</script>
// with ES6 import
import io from 'socket.io-client';

const socket = io('http://localhost');

A slim build (without JSON3, a JSON polyfill for IE6/IE7, and debug) is also available: socket.io.slim.js.

Socket.IO is compatible with browserify and webpack (see example there).

Node.JS (server-side usage)

Add socket.io-client to your package.json and then:

var socket = require('socket.io-client')('http://localhost');
socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});

API

See API

License

MIT

Description
No description provided
Readme MIT 43 MiB
Languages
TypeScript 63.8%
JavaScript 36%