示例#1
0
文件: App.js 项目: teikei/teikei
export const makeClient = apiUrl => {
  const client = feathers()
  client.configure(feathers.hooks())
  client.configure(feathers.rest(apiUrl).superagent(superagent))
  client.configure(
    feathers.authentication({
      storage: window.localStorage
    })
  )
  return client
}
示例#2
0
  it('receives turn events for each hangout', function (done) {
    var socket = io.connect('http://localhost:3000', {
      'transports': [
        'websocket',
        'flashsocket',
        'jsonp-polling',
        'xhr-polling',
        'htmlfile'
      ],
      'force new connection': true
    })
    var app = feathers()
    .configure(feathers.hooks())
    .configure(feathers.socketio(socket))
    var turns = app.service('turns')
    var recvdTurns = []
    for (var i = 0; i < testUsers; i++) { recvdTurns[i] = 0 }
    var isDone = false

    turns.on('created', function (turn) {
      var meeting = parseInt(turn.meeting.split('meeting')[1], 10)

      if (recvdTurns[meeting] >= 3) {
        if (!isDone) {
          isDone = true
          for (var i = 0; i < testUsers; i++) {
            assert.equal(recvdTurns[i], 3)
          }
          done()
          turns.off('created')
        }
      } else {
        recvdTurns[meeting] += 1
      }
    })
  })
const feathers = require('feathers-client');
const io = require('socket.io-client');

const socket = io();
export const app = feathers()
  .configure(feathers.socketio(socket))
  .configure(feathers.hooks())
  .configure(feathers.authentication({
    storage: window.localStorage
  }));