CNode

有人用过bone.io这个框架吗?

Yyakczh发布于12 年前最后回复12 年前1 回复4195 浏览0 收藏

觉是这个双向通信的设计思路挺好的,但是照着 http://bone.io/ 上面的的文档写了个例子,不知道如何把 route和 inbound/outbound 关联起来 在设置 inbound/outbound的时候 带命名空间,

  bone.io('chat', {
    outbound: {
        routes: ['broadcast']
    },
    inbound: {
        register: function(data, context) {
            this.join(data.room);
        },
        deregister: function(data, context) {
            this.leave(data.room);
        },
        send: function(data, context) {
            this.room(data.room).broadcast({message: data.message});
        }
    }
});

但是调置router的时候,又没有命名空间

bone.router({
    routes: {
        "start":"hello",
        "find/:query/p:page":   "search"   // #find/bones/p7
    },
    hello: function(context) {
        console.log(context);  
    },
    find: function(query, page) {
 console.log('find');  
       console.log(query);
 
    }
});

不知道两段代码中的routes 是根据什么关联起来的

查看回复

回复 (1)

L
leapon#1·12 年前

是不是太新了?没找到栗子

参与回复
登录后即可参与回复。登录