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

add 'unauthenticated' event, fix 'unsubscribed' event capabilities, update missing typedefs #147

Merged
merged 5 commits into from
Aug 15, 2023

Conversation

erictheswift
Copy link
Contributor

@erictheswift erictheswift commented Aug 10, 2023

Found that addClean reporter typedef is missing. Fixed.

Also while implementing suitable logging in my app I found out there are some bits missing:

  • client unauthorized event (while unauthorized reporter exists with insufficient data) — added
  • unsubscribe event does not have client nodeId server unsubscribes on ClientServer destroy — added without breaking changes

… allow advanced logging catch ServerClient (unavailable via reporter interface)
…rverNodeId (server-initiated -ch) or clientNodeId (client-initiated -ch)
…erverClient by evicting nodeIds / clientIds later, after unsubscribe
@ai
Copy link
Member

ai commented Aug 10, 2023

Can you add a description for PR?

@erictheswift
Copy link
Contributor Author

Added some motivation
Seemed commit messages are kinda descriptive atomic changes. Does this look like a candidate to split into multiple pull requests? :)

@ai
Copy link
Member

ai commented Aug 10, 2023

I needed a reason of changes. Now it is great.

It is minor change (0.X.x). Do you need it soon?

@erictheswift
Copy link
Contributor Author

Not at all — already applied a patch

@ai ai changed the base branch from main to next August 13, 2023 20:48
@@ -257,9 +257,15 @@ it('removes itself on destroy', async () => {
'10:client2': { filters: { '{}': true } }
}
}
let unsubscribedClientNodeIds: string[] = []
test.app.on('unsubscribed', (action, meta, clientNodeId) => {
unsubscribedClientNodeIds.push(clientNodeId)
Copy link
Member

Choose a reason for hiding this comment

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

2 space indent should be used

@@ -657,7 +657,7 @@ export class BaseServer {
}
}
}
this.emitter.emit('unsubscribed', action, meta)
this.emitter.emit('unsubscribed', action, meta, clientNodeId)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need extra parameter? We can use parseId(meta.id).clientId

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because in case of server-side channels cleanup (e.g. client is disconnected because of timeout), nodeId is server.nodeId

let actionId = this.app.log.generateId()

@ai ai merged commit b605bde into logux:next Aug 15, 2023
4 checks passed
ai pushed a commit that referenced this pull request Oct 8, 2023
…pdate missing typedefs (#147)

* add missing 'addClean' reporter type definition

* add BaseServer 'unauthenticated' event on par with 'authenticated' to allow advanced logging catch ServerClient (unavailable via reporter interface)

* add 'unsubscribed' event clientNodeId last arg (that can be either serverNodeId (server-initiated -ch) or clientNodeId (client-initiated -ch)

* ClientServerdestroy: allow 'unsubscribed' event handler to retrieve ServerClient by evicting nodeIds / clientIds later, after unsubscribe

* fix indent
ai pushed a commit that referenced this pull request Feb 10, 2024
…pdate missing typedefs (#147)

* add missing 'addClean' reporter type definition

* add BaseServer 'unauthenticated' event on par with 'authenticated' to allow advanced logging catch ServerClient (unavailable via reporter interface)

* add 'unsubscribed' event clientNodeId last arg (that can be either serverNodeId (server-initiated -ch) or clientNodeId (client-initiated -ch)

* ClientServerdestroy: allow 'unsubscribed' event handler to retrieve ServerClient by evicting nodeIds / clientIds later, after unsubscribe

* fix indent
ai pushed a commit that referenced this pull request Feb 15, 2024
…pdate missing typedefs (#147)

* add missing 'addClean' reporter type definition

* add BaseServer 'unauthenticated' event on par with 'authenticated' to allow advanced logging catch ServerClient (unavailable via reporter interface)

* add 'unsubscribed' event clientNodeId last arg (that can be either serverNodeId (server-initiated -ch) or clientNodeId (client-initiated -ch)

* ClientServerdestroy: allow 'unsubscribed' event handler to retrieve ServerClient by evicting nodeIds / clientIds later, after unsubscribe

* fix indent
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.

2 participants