Feathers: how does real-time work?

Created on 11 Oct 2016  Â·  10Comments  Â·  Source: feathersjs/feathers

I mean it works as in Meteor just pulling requests each 'n'ms trough Socket, or like in graphQL through subscription?

Because the first one is not the best solution for big projects.

All 10 comments

@sarkistlt, it works however you setup the transports for whichever provider plugin you use. Both Socket.io and Primus support multiple transports.

See http://socket.io/blog/introducing-socket-io-1-0/#new-engine or https://github.com/primus/primus#supported-real-time-frameworks

So, technically, it can be either. But generally, just as you mentioned, for performance reasons you would use subscription. Here's an example of how to lock in the socket.io provider to only allow subscriptions over websockets:

const io = require('socket.io-client/socket.io');
const socket = io('http://api.feathersjs.com', { 
  transports: ['websocket'] 
});
const app = feathers()
  .configure(feathers.hooks())
  .configure(socketio(socket));

Sorry. Didn't mean to close this. Please reopen if I didn't answer your question.

Thanks for quick answer, that sounds great!

One more thing. When I try to const io = require('socket.io-client/socket.io');

I get following error:

var isAndroid = navigator.userAgent.match(/Android/i);
                    ^

ReferenceError: navigator is not defined
    at Object.<anonymous> (/Users/Sarkis/Documents/_projects/Coda/hum-app_v2/node_modules/socket.io-client/socket.io.js:4796:18)
...
...
...

If you're working in node, just do const io = require('socket.io-client');

navigator is a global browser object. Not sure why they didn't make it const io = require('socket.io-client/browser'); for the browser

works now, thanks again)

BTW, the doc server responded with a status of 502

for example this link: https://docs.feathersjs.com/getting-started/scaffolding.html

Yeah GitBooks is down, but you can use the https://github.com/feathersjs/feathers-docs repo.

On Oct 11, 2016, at 10:32 AM, Sarkis [email protected] wrote:

BTW, the doc server responded with a status of 502

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/feathersjs/feathers/issues/424#issuecomment-252970780, or mute the thread https://github.com/notifications/unsubscribe-auth/AAH3Wdf0tleIDr-cDDOXZlpeCjOhDtrAks5qy7olgaJpZM4KTzsL.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ausir0726 picture ausir0726  Â·  3Comments

codeus-de picture codeus-de  Â·  4Comments

huytran0605 picture huytran0605  Â·  3Comments

corymsmith picture corymsmith  Â·  4Comments

davigmacode picture davigmacode  Â·  3Comments