Skip to content

polst/feathers-socketcluster

Repository files navigation

feathers-socketcluster

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

The Feathers SocketCluster real-time API provider

About

This provider exposes Feathers services through a SocketCluster real-time API. It is compatible with Feathers 2.x (1.x not tested).

Tests not working.

Note: For the full API documentation go to http://docs.feathersjs.com/real-time/socket-io.html.

Note: Not working with feathers authentication as there is an event naming collision between that package and SC (authenticate)

Quick example on SC worker controller

import feathers from 'feathers';
import feathersSocket from 'feathers-socketcluster';
let scServer = worker.scServer;
let httpServer = worker.httpServer;
const app = feathers()
  .configure(feathersSocket({socketServer: scServer}, function(io) {
    
  }));

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

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

app.setup(httpServer);

Client use

import socketCluster from 'socketcluster-client';
import feathers from 'feathers/client';
import feathersSC from 'feathers-socketcluster/client';

const socket = socketCluster.connect({ port: 8000 });
const app = feathers()
  .configure(feathersSC(socket));

License

Copyright (c) 2017

Licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published