addToken
codebolt.tokenizer.addToken(key: string): Promise<AddTokenResponse>
Adds a token to the system via WebSocket.
Parameters
Name | Type | Description |
---|---|---|
key | string | The key associated with the token to be added. |
Returns:
Promise<AddTokenResponse>
A promise that resolves with the response from the add token event.Example
import codebolt from '@codebolt/codeboltjs';
async function exampleAddToken() {
try {
const response = await codebolt.tokenizer.addToken("myTokenKey");
console.log("Token added successfully:", response);
} catch (error) {
console.error("Failed to add token:", error);
}
}
exampleAddToken();