6.3.6 • Published 7 years ago

iku-hub v6.3.6

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
7 years ago

iku hub

Sample usage

Server

var Server = require('iku-hub/server'),
    WsPm = require('i-pm/ws'),
    
    Room = Server.Room,
    server = require('http').createServer().listen(8080),
    
    hub = new Server(WsPm(server,'.hub')),
    room = new Room();

hub.walk(function*(){
  var client;
  
  while(true){
    client = yield this.until('client');
    room.add(client);
  }
  
});

Client

var Client = require('iku-hub/client'),
    WsP = require('i-peer/ws'),
    
    hub = new Client(WsP('ws://localhost:8080/.hub/'));

hub.walk(function*(){
  var room = yield this.until('room');
  
  room.walk(function* cb(){
    var peer = yield this.until('peer');
    
    this.walk(cb);
    peer.send('hi');
    
    peer.walk(function* cb(){
      var msg = yield this.until('msg');
      
      this.walk(cb);
      console.log(msg); // hi
    });
    
  });
  
});
6.3.6

7 years ago

6.3.5

9 years ago

6.3.4

9 years ago

6.3.3

9 years ago

6.3.2

9 years ago

6.3.1

9 years ago

6.3.0

9 years ago

6.2.0

9 years ago

6.1.1

9 years ago

6.1.0

9 years ago

6.0.1

9 years ago

6.0.0

9 years ago

5.10.0

9 years ago

5.9.0

9 years ago

5.8.0

9 years ago

5.7.0

9 years ago

5.6.0

9 years ago

5.5.1

9 years ago

5.5.0

9 years ago

5.4.0

9 years ago

5.3.0

9 years ago

5.2.0

9 years ago

5.1.2

9 years ago

5.1.1

9 years ago

5.1.0

9 years ago

5.0.0

9 years ago

4.0.2

9 years ago

4.0.1

9 years ago

4.0.0

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.1.2

9 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.0

9 years ago

1.5.0

9 years ago

1.4.0

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.0.0

9 years ago