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

Logitech#765 - Provide support for npm cometd client #767

Merged
merged 1 commit into from Feb 20, 2022
Merged

Logitech#765 - Provide support for npm cometd client #767

merged 1 commit into from Feb 20, 2022

Conversation

lynniemagoo
Copy link
Contributor

Provide support for npm cometd client that requires that server echo 'id' fields from 'meta/*' messages to support callbacks and notifications.

…at server echo 'id' fields from 'meta/*' messages to support callbacks and notifications.
Copy link
Member

@michaelherger michaelherger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change makes sense - thanks a lot! Please modify as per my comment. I'll be happy to merge to 8.3 first, then potentially back port it later (when confirmed working in 8.3). There's no need for two pull requests. They's eventually conflict with each other.

Comment on lines +160 to +169
my $msgid;
if ( !$msgid ) {
# obtain 'id' from outer object if present, otherwise default to - Here we use different variable name '$msgid' as '$id' is defined for use within slim/subscribe channel.
if ( $obj->{id} ) {
$msgid = $obj->{id};
} else {
#default to empty string if not available.
$msgid = '';
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$msgid will always be falsy right after definition. This block could be simplified to the following, couldn't it?

my $msgid = $obj->{id} || '';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I'll do this on my end. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes Michael. that is perfect and what I'd have done if I knew how.

I'm a VisualBasic, C/C++, Java, NodeJS, Fortran, C#, .NET guy.
I dabbled in Perl and Python early on and to get the right syntax, I Google.

While working on this I considered the following:
In the /slim/request section we could move the my $id variable to the top and use it instead of my $msgid. That way there's no confusion and $id means $id.

Please double-check my work for all the error conditions to make sure I did not screw things up.

@cleemansen
Copy link

Thx for this PR! Will solve #765 (and #478)

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

Successfully merging this pull request may close these issues.

None yet

4 participants