c512319 / chat-server Goto Github PK
View Code? Open in Web Editor NEWSimple websocket chat server.
License: Eclipse Public License 1.0
Simple websocket chat server.
License: Eclipse Public License 1.0
chat-server.routes.websocket
第22行,最好改成
(def current-id (atom 0))
(defn next-id []
(swap! current-id inc)
@current-id)
原因: 定义式(defn、def)不推荐放在域内,在某些环境下,这可能导致不可预料的效果
dummy in-memory database最好作为独立的命名空间存在,以方便分离依赖
观察到chat-server.routes.websocket/chatrooms
有很多通过id拿chatroom的操作,可以考虑将其用hashmap表示以提高读性能(尤其对于chatroom这类,项数随用户无限制增长的,用filter很可能导致非常低的效率)
Users也有相同问题
使用future-sleep-loop的方式进行定时轮询简单粗暴,但会长期闲置一个线程,可尝试通过core.async的timeout channel实现(可熟悉:CSP异步模型)
命名空间组织较为混乱,逻辑层级关系不清晰,需要整理
项目此规模下只有一个git commit 并不合理,尽量能够在开发时较为频繁地commit,原则上以一句commit能够说明你做的事为准。
这些并没有明确的时间要求,而且多数都是参考意见,可不遵循。
你可以先自己择时修缮起来,好了之后通知我~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.