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

[web-pubsub-client/react] Export WebPubSubClientState type & Expose _state #24333

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ export class WebPubSubClient {
sendEvent(eventName: string, content: JSONTypes | ArrayBuffer, dataType: WebPubSubDataType, options?: SendEventOptions): Promise<WebPubSubResult>;
sendToGroup(groupName: string, content: JSONTypes | ArrayBuffer, dataType: WebPubSubDataType, options?: SendToGroupOptions): Promise<void | WebPubSubResult>;
start(options?: StartOptions): Promise<void>;
// (undocumented)
_state: WebPubSubClientState;
stop(): void;
}

Expand All @@ -274,6 +276,20 @@ export interface WebPubSubClientProtocol {
writeMessage(message: WebPubSubMessage): string | ArrayBuffer;
}

// @public (undocumented)
export enum WebPubSubClientState {
// (undocumented)
Connected = "Connected",
// (undocumented)
Connecting = "Connecting",
// (undocumented)
Disconnected = "Disconnected",
// (undocumented)
Recovering = "Recovering",
// (undocumented)
Stopped = "Stopped"
}

// @public
export type WebPubSubDataType =
/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/web-pubsub/web-pubsub-client/src/webPubSubClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { WebPubSubClientCredential } from "./webPubSubClientCredential";
import { WebSocketClientFactory } from "./websocket/websocketClient";
import { WebSocketClientFactoryLike, WebSocketClientLike } from "./websocket/websocketClientLike";

enum WebPubSubClientState {
export enum WebPubSubClientState {
Stopped = "Stopped",
Disconnected = "Disconnected",
Connecting = "Connecting",
Expand All @@ -69,7 +69,7 @@ export class WebPubSubClient {
private readonly _reconnectRetryPolicy: RetryPolicy;

private readonly _emitter: EventEmitter = new EventEmitter();
private _state: WebPubSubClientState;
public _state: WebPubSubClientState;
private _isStopping: boolean = false;
private _ackId: number;

Expand Down