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

rtm-api: add support for custom webClient #1696

Merged
merged 5 commits into from
Nov 27, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/rtm-api/src/RTMClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,10 @@
serverPongTimeout,
replyAckOnReconnectTimeout = 2000,
tls = undefined,
webClient,
}: RTMClientOptions = {}) {
super();
this.webClient = new WebClient(token, {
this.webClient = webClient || new WebClient(token, {
slackApiUrl,
logger,
logLevel,
Expand Down Expand Up @@ -628,7 +629,7 @@
let event;
try {
event = JSON.parse(data);
} catch (parseError: any) {

Check warning on line 632 in packages/rtm-api/src/RTMClient.ts

View workflow job for this annotation

GitHub Actions / test (18.x, packages/rtm-api)

Unexpected any. Specify a different type

Check warning on line 632 in packages/rtm-api/src/RTMClient.ts

View workflow job for this annotation

GitHub Actions / test (20.x, packages/rtm-api)

Unexpected any. Specify a different type
// prevent application from crashing on a bad message, but log an error to bring attention
this.logger.error(
`unable to parse incoming websocket message: ${parseError.message}\n message contents: "${data}"`,
Expand Down Expand Up @@ -672,6 +673,7 @@
*/

export interface RTMClientOptions {
webClient?: WebClient;
slackApiUrl?: string;
logger?: Logger;
logLevel?: LogLevel;
Expand Down