Skip to content

Commit 8cfea03

Browse files
authored
Allow calling internal methods also as notifications (#19)
1 parent b765576 commit 8cfea03

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/msgpackrouter/router.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ func (r *Router) connectionLoop(conn io.ReadWriteCloser) {
129129
// This handler is called when a notification is received from the client
130130
slog.Debug("Received notification", "method", method, "params", params)
131131

132+
// Check if the method is an internal method
133+
if handler, ok := r.routesInternal[method]; ok {
134+
// call the internal method handler (since it's a notification, discard the result)
135+
_, _ = handler(context.Background(), msgpackconn, params)
136+
return
137+
}
138+
132139
// Check if the method is registered
133140
client, ok := r.getConnectionForMethod(method)
134141
if !ok {

0 commit comments

Comments
 (0)