feathers-socketio-ssr
Switch feathers-socketio requests to use feathers-rest in a server environment
Installation
npm install feathers-socketio-ssr --save
Documentation
Please refer to the feathers-socketio-ssr documentation for more details.
Complete Example
Here's an example of a Feathers client that uses feathers-socketio-ssr
.
const feathers = ;const socketio = ;const rest = ;const hooks = ;const io = ;const sa = ; const socket = ; const feathersClient = // Use the plugin in a Feathers Client application ; moduleexports = feathersClient;
API
socketio(socket, isSsrFn, alternateProvider)
Automatically switches isomorphic code to use a different provider in a server side rendering environment.
const feathers = ;const socketio = ;const rest = ;const sa = ;const io = ; const socket = ;const isCustomEnvironment = { return true;} const feathersClient = // Use the plugin in a Feathers Client application ; moduleexports = feathersClient;
- socket
{SocketIO}
: A SocketIO socket. - isSsr
{Boolean}
: allows use of custom logic to determine if the provider should switch from socketio to the alternateProvider. - alternateProvider
{FeathersProvider}
: allows for customizing the provider that the SSR server will use. If not passed, it will usefeathers-rest
configured for jQuery Ajax. You must install jQuery separately.
License
Copyright (c) 2016
Licensed under the MIT license.