Skip to content

myknbani/feathers-socketio

This branch is 2 commits ahead of, 62 commits behind feathersjs-ecosystem/socketio:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1584daa · Mar 1, 2017

History

83 Commits
Oct 22, 2016
Feb 24, 2017
Feb 24, 2017
Jan 2, 2016
Nov 30, 2016
Jan 2, 2016
Jan 2, 2016
Oct 17, 2016
Oct 26, 2016
Nov 2, 2016
Apr 28, 2016
Jan 2, 2016
Oct 26, 2016
Mar 1, 2017
Jan 10, 2016
Mar 1, 2017
Oct 17, 2016
Mar 1, 2017

Repository files navigation

feathers-socketio

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 http://docs.feathersjs.com/real-time/socket-io.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.

About

The Feathers Socket.io real-time API provider

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%