How to use the @feathersjs/client function in @feathersjs/client

To help you get started, we’ve selected a few @feathersjs/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alltogethernow / web / src / modules / feathers-services.js View on Github external
import io from 'socket.io-client'
import feathers, { socketio, authentication } from '@feathersjs/client'

const socket = io(process.env.REACT_APP_API_SERVER, {
  transports: ['websocket'],
  forceNew: true,
})

const client = feathers()

client.configure(socketio(socket, { timeout: 10000 }))
client.configure(
  authentication({
    storage: window.localStorage,
    entity: 'user',
    service: 'users',
  })
)
// Try to prevent login timeouts although I don't think it actually works
// TODO: investigate how to fix this
client.service('authentication').timeout = 20000
client.service('users').timeout = 20000

export const channels = client.service('api/channels')
export const posts = client.service('api/posts')
github telstra / openapi-platform / src / client / BackendClient.tsx View on Github external
export function createBackendClient(): BackendClient {
  const socket = io('http://localhost:8080', {
    transports: ['websocket'],
  });
  const app = feathers();
  app.configure(feathers.socketio(socket));
  // TODO: Actually wrap client rather than just returning client
  return app;
}
github telstra / openapi-platform / packages / server-client / src / index.ts View on Github external
export function createServerClient(url): ServerClient {
  const socket = io(url, {
    transports: ['websocket'],
  });
  const app = feathers();
  app.configure(
    feathers.socketio(socket, {
      // TODO: Definately shouldn't be this long
      timeout: 60000,
    }),
  );
  // TODO: Actually wrap client rather than just returning client
  return { client: app, socket };
}
github nesterow / frontless / src / client.js View on Github external
}
      return Promise.resolve(context)
    }],
  },
  error: (context) => {
    if (typeof window !== 'undefined') {
      const {name} = context.service;
      evbus.emit('request:error', context)
      evbus.emit(name+':error', context)
    }
  }
};

const endpoint = 'http://localhost:8000';

const app = feathers()
if (typeof window !== 'undefined') {
  const ws = io(endpoint)
  const wsc = feathers()
  wsc.configure(socketio(ws, {
    timeout: 2000,
  }));
  wsc.hooks(hooks)
  app.io = wsc
  app.ws = ws
  
}

const rest = feathers.rest(endpoint)

app.configure(rest.axios(axios))
app.hooks(hooks)
github nesterow / frontless / src / client.js View on Github external
},
  error: (context) => {
    if (typeof window !== 'undefined') {
      const {name} = context.service;
      evbus.emit('request:error', context)
      evbus.emit(name+':error', context)
    }
  }
};

const endpoint = 'http://localhost:8000';

const app = feathers()
if (typeof window !== 'undefined') {
  const ws = io(endpoint)
  const wsc = feathers()
  wsc.configure(socketio(ws, {
    timeout: 2000,
  }));
  wsc.hooks(hooks)
  app.io = wsc
  app.ws = ws
  
}

const rest = feathers.rest(endpoint)

app.configure(rest.axios(axios))
app.hooks(hooks)


export default app
github feathersjs-ecosystem / feathers-chat-react / src / feathers.js View on Github external
import io from 'socket.io-client';
import feathers from '@feathersjs/client';

const socket = io('http://localhost:3030');
const client = feathers();

client.configure(feathers.socketio(socket));
client.configure(feathers.authentication({
  storage: window.localStorage
}));

export default client;
github nesterow / frontless / src / lib / client.js View on Github external
opts._t === '/m/') {
        evbus.trigger('update:' + opts._id, context.result.data);
      }
      return Promise.resolve(context);
    }],
  },
};

const endpoint = process.settings.origin;


const ws = io(endpoint);
const rest = feathers.rest(endpoint);

const app = feathers();
const wsc = feathers();


app.configure(rest.axios(axios));
wsc.configure(socketio(ws, {
  timeout: 2000,
}));

wsc.hooks(hooks);
app.hooks(hooks);
app.io = wsc;
app.ws = ws;

export default app;
github nesterow / frontless / src / lib / client.js View on Github external
if (typeof opts === 'object' &&
          opts._t === '/m/') {
        evbus.trigger('update:' + opts._id, context.result.data);
      }
      return Promise.resolve(context);
    }],
  },
};

const endpoint = process.settings.origin;


const ws = io(endpoint);
const rest = feathers.rest(endpoint);

const app = feathers();
const wsc = feathers();


app.configure(rest.axios(axios));
wsc.configure(socketio(ws, {
  timeout: 2000,
}));

wsc.hooks(hooks);
app.hooks(hooks);
app.io = wsc;
app.ws = ws;

export default app;

@feathersjs/client

A module that consolidates Feathers client modules for REST (jQuery, Request, Superagent) and Websocket (Socket.io, Primus) connections

MIT
Latest version published 2 months ago

Package Health Score

90 / 100
Full package analysis