Exemplo n.º 1
0
io.on('upstream', (ctx, action) => {
  switch (action.type) {
    case BUY:
      io.broadcast('downstream', buy(action.payload));
      break;

    default:
      throw new Error(`Unhandle action.type: ${JSON.stringify(action)}`);
  }
});
Exemplo n.º 2
0
timer$.subscribe(() => {
  io.broadcast(
    'downstream',
    countDown(setTimer(getTimer() - 1))
  );
});
Exemplo n.º 3
0
io.on('command', (ctx, data) => {
  console.log('command', data);
  io.broadcast('command', data);
});