Giter VIP home page Giter VIP logo

Comments (5)

reqshark avatar reqshark commented on July 24, 2024

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.

kkartunov avatar kkartunov commented on July 24, 2024

@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.

reqshark avatar reqshark commented on July 24, 2024

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.

gdamore avatar gdamore commented on July 24, 2024

FYI: I'm planning to rip out the NN_ALLOC_MONITOR facility.

from node-nanomsg.

reqshark avatar reqshark commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.