Skip to content

Commit 0ea5fb0

Browse files
committed
use default deployment ID for connectSocket
1 parent 691201a commit 0ea5fb0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/tpy.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,17 @@ export class Tpy {
212212
* @param deploymentID The deployment ID to follow the WebSocket when it disconnects. If empty, the function
213213
* will use the set {@linkcode Tpy.deploymentID} in the class.
214214
*/
215-
connectSocket(deploymentID: string) {
216-
return new TpyWs(this, deploymentID);
215+
connectSocket(deploymentID?: string) {
216+
const dID = deploymentID || this.deploymentID;
217+
if (!dID) {
218+
throw new TpyError(
219+
"Missing or Invalid Required Parameter",
220+
parametersPrompt("missing", ["deploymentID", "this.deploymentID"]),
221+
["deploymentID", "this.deploymentID"].join(", "),
222+
dID
223+
);
224+
}
225+
return new TpyWs(this, dID);
217226
}
218227

219228
/**

0 commit comments

Comments
 (0)