Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

feathers-socketio

feathersjs4.4kMITdeprecated2.0.1TypeScript support: included

Feathers v3 is out and this module has moved to @feathersjs/socketio and @feathersjs/socketio-client. See https://docs.feathersjs.com/migrating.html for more information.

The Feathers Socket.io real-time API provider

feathers, feathers-plugin

readme

feathers-socketio

Important: For Feathers v3.0.0 or later use @feathersjs/socketio module instead of feathers-socketio.

Greenkeeper badge

Build Status Code Climate Test Coverage Dependency Status Download Status Slack Status

The Feathers Socket.io real-time API provider

About

This provider exposes Feathers services through a Socket.io real-time API. It is compatible with Feathers 1.x and 2.x.

Note: For the full API documentation go to https://docs.feathersjs.com/api/socketio.html.

Quick example

import feathers from 'feathers';
import socketio from 'feathers-socketio';

const app = feathers()
  .configure(socketio(function(io) {
    io.on('connection', function(socket) {
      socket.emit('news', { hello: 'world' });
      socket.on('my other event', function (data) {
        console.log(data);
      });
    });

    io.use(function(socket, next) {
      socket.feathers.data = 'Hello world';
      next();
    });

    io.use(function (socket, next) {
      // Authorize using the /users service
      app.service('users').find({
        username: socket.request.username,
        password: socket.request.password
      }, next);
    });
  }));

app.use('/todos', {
  get: function(id, params) {
    console.log(params.data); // -> 'Hello world'

    return Promise.resolve({
      id,
      description: `You have to do ${name}!`
    });
  }
});

Client use

import io from 'socket.io-client';
import feathers from 'feathers/client';
import socketio from 'feathers-socketio/client';

const socket = io('http://path/to/api');
const app = feathers()
  .configure(socketio(socket));

License

Copyright (c) 2015

Licensed under the MIT license.

changelog

Change Log

v1.4.0 (2016-04-28)

Full Changelog

Merged pull requests:

v1.3.4 (2016-04-16)

Full Changelog

Merged pull requests:

v1.3.3 (2016-02-18)

Full Changelog

Closed issues:

  • Needs possibility to pass options to io.listen() #12

Merged pull requests:

  • Allow to pass Socket.io options #13 (daffl)

v1.3.2 (2016-02-11)

Full Changelog

Merged pull requests:

  • Allow to instantiate a client instance #11 (daffl)

v1.3.1 (2016-02-09)

Full Changelog

v1.3.0 (2016-02-09)

Full Changelog

Merged pull requests:

v1.2.0 (2016-01-21)

Full Changelog

Closed issues:

  • Better event filtering #2

Merged pull requests:

  • Refactoring to use feathers-socket-commons that support event filtering #5 (daffl)
  • Fixing .npmignore entries #3 (corymsmith)

v1.1.0 (2016-01-10)

Full Changelog

Merged pull requests:

  • feathers-socketio/client service and tests #1 (daffl)

v1.0.0 (2016-01-03)

* This Change Log was automatically generated by github_changelog_generator