The Feathers SocketCluster real-time API provider
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
)
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);
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));
Copyright (c) 2017
Licensed under the MIT license.