How to use @feathersjs/client - 10 common examples

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 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 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')
export const search = client.service('api/search')
export const follows = client.service('api/follows')
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')
export const search = client.service('api/search')
export const follows = client.service('api/follows')
export const micropub = client.service('api/micropub')
export const users = client.service('users')
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;

@feathersjs/client

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

MIT
Latest version published 18 days ago

Package Health Score

90 / 100
Full package analysis