Closed atian25 closed 7 years ago
exports.io = {
middleware: {
connection: [ 'auth' ], // connection middleware
packet: [ 'filter' ], // packet middleware
}
};
这样怎么样?
另外, 这里会不会存在数组配置合并的问题?
这个只有应用会配,问题不大的
cmiddleware
这种命名有点让人疑惑
connectionMiddleware
和 packetMiddleware
吧,这种不要简写
@ngot 把两者方案选型的考虑, 以及最终方案, 更新到顶楼吧.
嗯。我还在继续看,上下文,session那块,等完整了,更新到正文。
@ngot 先更新一版吧,需要补全的地方,注明下。
等会我要发 egg-feed 了
我觉得可以参考下sailsjs。那上面的websocket,我看着炒鸡爽
@luicfer 提炼下写下提案?
我还在国外考驾照…下周发个版
@ngot 提案也更新到顶楼吧
@atian25 done
发了 + egg-socket.io@1.0.0-beta.1 了。求试用建议@_@
有没有写 examples/socket.io
? 这样试用方便点
好, 回头可以放到 https://github.com/eggjs/examples
已经发布 1.0.0
Directory Structure
Configuration
Middleware
middleware are functions which every connection or packet will be processed by.
Connection Middleware
app/io/middleware/auth.js
config/config.default.js
pay attention to the namespace, the config will only work for a specific namespace.
Packet Middleware
app/io/middleware/filter.js
config/config.default.js
pay attention to the namespace, the config will only work for a specific namespace.
Controller
controller is designed to handle the
emit
event from the client.example:
app/io/controller/chat.js
next, config the router at
app/router.js