Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ export class Client<
}
}

async ping() {
return this.request({ method: "ping" }, EmptyResultSchema);
async ping(options?: RequestOptions) {
return this.request({ method: "ping" }, EmptyResultSchema, options);
}

async complete(params: CompleteRequest["params"], options?: RequestOptions) {
Expand All @@ -290,10 +290,11 @@ export class Client<
);
}

async setLoggingLevel(level: LoggingLevel) {
async setLoggingLevel(level: LoggingLevel, options?: RequestOptions) {
return this.request(
{ method: "logging/setLevel", params: { level } },
EmptyResultSchema,
options,
);
}

Expand Down Expand Up @@ -352,17 +353,25 @@ export class Client<
);
}

async subscribeResource(params: SubscribeRequest["params"]) {
async subscribeResource(
params: SubscribeRequest["params"],
options?: RequestOptions,
) {
return this.request(
{ method: "resources/subscribe", params },
EmptyResultSchema,
options,
);
}

async unsubscribeResource(params: UnsubscribeRequest["params"]) {
async unsubscribeResource(
params: UnsubscribeRequest["params"],
options?: RequestOptions,
) {
return this.request(
{ method: "resources/unsubscribe", params },
EmptyResultSchema,
options,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export function abortAfterTimeout(timeoutMs: number): AbortSignal {
const controller = new AbortController();
setTimeout(() => {
controller.abort();
controller.abort("Timeout exceeded");
}, timeoutMs);

return controller.signal;
Expand Down