matti / async-nats Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
So, I can sort of see what you are trying to do here, but I think this is an example of a method that's implementing too much user level policy and making the structure of your code overlay complex without much benefit.
async-nats/lib/async/nats/client.rb
Line 43 in a6dd9b4
This line @server_info, @connection, @stream, @line_protocol = __connect
is very stateful.
You should think about how you could make Client
immutable from the POV of the user. Calling start!
more the once will break your implementation, for example.
async-nats/lib/async/nats/client.rb
Line 153 in a6dd9b4
I see that I should probably document the preferred patterns to use. Otherwise it's tricky for users to reason about the code.
One way to minimise this is to use the async-await gem which provides some built in high level patterns.
https://github.com/socketry/async-await/blob/master/README.md
async-nats/lib/async/nats/client.rb
Line 128 in a6dd9b4
I suggest you have an API which returns an object that responds to #wait
. The user can decide whether to wait rather than passing it as an argument.
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.