Comments (5)
both bind
and connect
are blocking functions without completion events, i think.
@comick would know more about that but generally one should allow for about 50-100 milliseconds for the TCP handshakes and roundtrips to settle down, depends on distance or network conditions.
these are good questions probably not explained enough by the documentation. @ColorfullyMe, would you consider a making a PR to help document what's missing?
@nickdesaulniers or I (whoever is available) I'm sure would be happy to review a PR so we can finally document these mechanisms facilitating re-use of the module. these are fundamental.
error
and message
are probably the most notable. survey-timeout
is more of an internal thing written at a time when the underlying nanomsg C library offered less support for the survey/respondent pattern. So I wouldn't worry about that event too much. While survey/respondent works, the fact that our socket prototype pattern diverges with an additional specific function for handling this pattern elsewhere in the code is definitely not cool. Inconsistency of implementation in the module's socket prototype methods only complicate matters and misguides users on what the hell is going on. We should try to be more consistent and I would love to see that area of the code improved.
if we could document more events with an example it'd be great, i.e., message
would be cool like:
socket.on('message', callback);
function callback (msg) {
// handle the msg parameter here
// or msg param could be given to an anonymous function
// instead of using this named declaration style
}
from node-nanomsg.
@reqshark I am new to node-nanomsg
but will love to consider making a PR when I know more deeply what happens here :)
What I was after with this question was to gather knowledge how to have some basic socket statistics. I wan to know how many connected sockets there are, IPs etc things like that. Drop some of them say if they fail some sort of initial authorization.
It looks that node-nanomsg
does not support this but this seems to be related that nanomsg
itself is lacking build in support for statistics. What do you suggest?
from node-nanomsg.
it might be possible to initialize the library in one of its debug mode varieties. There's a memory allocation debugging utility built into libnanomsg, NN_ALLOC_MONITOR
. There may be more socket reporting information available as well, but I'm not sure how much documentation is available from libnanomsg. I'm sure the mailing list can help there. We would need to figure out a way to expose that over the binding
also btw, we just introduced a major update in node-nanomsg v2. we're now using streams instead of EventEmitter, so the recv api is different... though socket.send(msg)
hasn't changed
from node-nanomsg.
FYI: I'm planning to rip out the NN_ALLOC_MONITOR facility.
from node-nanomsg.
cool thanks for the heads up @gdamore!
looks like you're simplifying things upstream and got rid of ebase too
from node-nanomsg.
Related Issues (20)
- add support for nng HOT 4
- Error handling HOT 3
- TypeError: Path must be a string. Received undefined HOT 2
- rfc links
- Compile error in Node V12.* HOT 6
- vulnerable dependencies HOT 1
- deprecation warning from Nan::Callback::call HOT 2
- DeprecationWarning: Buffer HOT 2
- remove package-lock.json from .gitignore HOT 2
- fallthrough warnings in nanomsg HOT 1
- are we handling scopes correctly? HOT 1
- How do i catch timeout on reqrep?
- Carsh When msg send 10K per second HOT 2
- Electron compatibility: "Loading non-context-aware native module in renderer" HOT 1
- node 14.15 compatability HOT 1
- (node:660) electron: The default of contextIsolation is deprecated and will be c hanging from false to true in a future release of Electron. HOT 2
- Double handle scope
- -Wcast-function-type in nodejs/src/node.h
- sub: filter by binary chan prefix? HOT 1
- npm install --use_system_libnanomsg=true fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-nanomsg.