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

Disconnected event does not deliver data object #511

Closed
mariomurrent-softwaresolutions opened this issue Mar 29, 2018 · 12 comments
Closed
Assignees

Comments

@mariomurrent-softwaresolutions
Copy link

mariomurrent-softwaresolutions commented Mar 29, 2018

jssipInstance.on('disconnected', function(data) { // code here });

The data object is undefined. Concerning the documentation there should be at least socket, error, code and reason in the data object.

@ibc ibc assigned ibc and jmillan Mar 29, 2018
@ibc
Copy link
Member

ibc commented Mar 29, 2018

True. This happens due to this line in Transport.js:

https://github.com/versatica/JsSIP/blob/master/lib/Transport.js#L163

There we are calling disconnected without any data.

@mariomurrent-softwaresolutions
Copy link
Author

Oh I see. I noticed it, because I was upgrading to the latest version. In the old version the disconnect event was called with data.

@jmillan
Copy link
Member

jmillan commented Apr 3, 2018

True, the error data attribute should be there and should be set to false in this case, when the transport is closed by the user.

code and reason data attributes are optional and related to disconnection errors. They do not apply here.

http://jssip.net/documentation/3.2.x/api/socket/#event_ondisconnect

Thanks for reporting, I'll update it.

@ibc
Copy link
Member

ibc commented Apr 3, 2018

In fact, the payload of the disconnected event should be refactored. It assumes WebSocket, but that's just when we use the WebSocket transport.

@jmillan
Copy link
Member

jmillan commented Apr 4, 2018

It assumes WebSocket, but that's just when we use the WebSocket transport.

Can you point it in the code?

@ibc
Copy link
Member

ibc commented Apr 4, 2018

Not in the code but in the doc: http://jssip.net/documentation/3.2.x/api/ua/#event_disconnected

@mariomurrent-softwaresolutions
Copy link
Author

That's true. The documentation differs from the actual code.

@jmillan
Copy link
Member

jmillan commented Apr 4, 2018

Not in the code but in the doc: http://jssip.net/documentation/3.2.x/api/ua/#event_disconnected

Aha, true. I'll synchronise it ASAP.

@mariomurrent-softwaresolutions
Copy link
Author

So there will be no more parameters for the disconnect event?

@jmillan
Copy link
Member

jmillan commented Apr 4, 2018

@jmillan jmillan closed this as completed in ca3e4eb Apr 5, 2018
@jmillan
Copy link
Member

jmillan commented Apr 5, 2018

UA:disconnected event payload has been fixed for that case where it was empty.

After reviewing the doc I see that it's aligned with the implementation. Such event does not assume WebSocket, but Jssip:Socket instance.

@jmillan
Copy link
Member

jmillan commented Apr 5, 2018

If there's any comment on this regard, please speak up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants