Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Error reporting not working #465

Closed
garzfaust opened this issue Apr 26, 2021 · 17 comments
Closed

[5.x] Error reporting not working #465

garzfaust opened this issue Apr 26, 2021 · 17 comments

Comments

@garzfaust
Copy link

Im am using version 5.x. Here is what i did:

let socket = zeromq.createSocket('dealer')
socket.monitor()

Now do i use bind() or connect()? What is the difference?

The next question is, how to catch errors with these functions? I am using connect and i bound to every event, which i had to find out by studying the source code, and i am getting the following output (ip address obliterated):

connect_delay 36 tcp://xx.xx.xx.xx:xxxx undefined
connect 39 tcp://xx.xx.xx.xx:xxxx undefined
disconnect 39 tcp://xx.xx.xx.xx:xxxx undefined
connect_retry 155 tcp://xx.xx.xx.xx:xxxx undefined
connect_delay 36 tcp://xx.xx.xx.xx:xxxx undefined
connect 39 tcp://xx.xx.xx.xx:xxxx undefined
disconnect 39 tcp://xx.xx.xx.xx:xxxx undefined
connect_retry 173 tcp://xx.xx.xx.xx:xxxx undefined
connect_delay 36 tcp://xx.xx.xx.xx:xxxx undefined
connect 41 tcp://xx.xx.xx.xx:xxxx undefined
disconnect 41 tcp://xx.xx.xx.xx:xxxx undefined
connect_retry 130 tcp://xx.xx.xx.xx:xxxx undefined
connect_delay 36 tcp://xx.xx.xx.xx:xxxx undefined
connect 39 tcp://xx.xx.xx.xx:xxxx undefined
disconnect 39 tcp://xx.xx.xx.xx:xxxx undefined
connect_retry 144 tcp://xx.xx.xx.xx:xxxx undefined
connect_delay 36 tcp://xx.xx.xx.xx:xxxx undefined
connect 41 tcp://xx.xx.xx.xx:xxxx undefined
disconnect 41 tcp://xx.xx.xx.xx:xxxx undefined
connect_retry 171 tcp://xx.xx.xx.xx:xxxx undefined
connect_delay 36 tcp://xx.xx.xx.xx:xxxx undefined
connect 41 tcp://xx.xx.xx.xx:xxxx undefined
disconnect 41 tcp://xx.xx.xx.xx:xxxx undefined

I printed the three arguments that are given to me, the message id, the address and an error object. The error object is undefined for every event, which is strange, because obviously, something is not working. What should does this output tell me? I also have a working ZMQ script in Python which proves that the server i want to connect to is working. I want to achieve the same results in Node.

@garzfaust

This comment was marked as abuse.

@aminya
Copy link
Member

aminya commented Apr 26, 2021

I added a couple of comments in #464 about some of your questions.

#464 (comment)

@garzfaust

This comment was marked as abuse.

@aminya
Copy link
Member

aminya commented Apr 26, 2021

You're welcome.

When the promise that bind returns is resolved, you will be sure that the connection is made. For testing, maybe use bindSync(...) because it waits until it is connected. For the production use await bind(...).

If you prefer to use connect, then remember that it connects in the background, so you will not know if it is connected. You should add on listeners.

When the error of a listener is undefined, it means that no error has happened. Maybe @n-riesco can help more.

@garzfaust

This comment was marked as abuse.

@garzfaust

This comment was marked as abuse.

@garzfaust

This comment has been minimized.

@garzfaust

This comment was marked as abuse.

@garzfaust

This comment was marked as abuse.

@overflowz
Copy link

@gastmeier all I'm gonna say is that contributions are welcome. I'm not sorry if things do not work around you, sir.

@garzfaust

This comment was marked as abuse.

@overflowz
Copy link

Just for your information, I've never been part of ZeroMQ, in fact, I just found this library by myself and want to play with it. Whenever I'm facing any issues, I'm contributing (you wanted typescript support, here it is: DefinitelyTyped/DefinitelyTyped#52566).

@garzfaust

This comment has been minimized.

@garzfaust

This comment was marked as abuse.

@overflowz
Copy link

Listen here buddy, it's not about fame. I also needed types for v5 so instead of keeping them for myself only, I opened a PR here for everyone to be able to use it. If you really read that ticket/PR, you'd see that it got rejected, because it was lacking documentation. All I did was that I updated v4 types to v5 (with its documentation).

Do keep in mind that we also have our lives too. If you don't like it, just don't use it. If you like it, but something is blocking you from using it, feel free to contribute. Otherwise, enjoy whatever you have for free.

@overflowz
Copy link

overflowz commented Apr 26, 2021

Dude, if you can't find the documentation, go check the source code. There's also a function called 'bindSync' in v5, use that if you really want it (DefinitelyTyped/DefinitelyTyped#52566 (comment))

OR: if you really want it to be async, you can just promisify the .bind

@aminya
Copy link
Member

aminya commented Apr 26, 2021

The discussion here has served its purpose, and the issue is solved. Any contribution that solves the mentioned problems is appreciated.

I am closing this issue because it violates the code of conduct.
https://zeromq.org/community/code-of-conduct/

@aminya aminya closed this as completed Apr 26, 2021
@zeromq zeromq locked as resolved and limited conversation to collaborators Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants