roomie-sdk
v1.0.6
Published
A standard Node.js SDK project
Readme
Roomie SDK
Roomie SDK is a client-side library for communicating with the parent window via postMessage. It simplifies sending messages and handling asynchronous responses.
Installation
npm install roomie-sdkUsage
ES Module / TypeScript
import { RoomieSDK } from 'roomie-sdk';
// Initialize the SDK
const sdk = new RoomieSDK();
// Example: Change chat context
await sdk.asyncChangeChat('newChatId');
// Example: Get data asynchronously
const userInfo = await sdk.asyncGetInfo('userInfo');
console.log(userInfo);API
new RoomieSDK()
Initializes the SDK and starts listening for messages from the parent window.
Methods
asyncChangeChat(activeKey: any): Promise<void>Sends achangeChatevent with the provided key to switch chat context.asyncGetInfo(syncType: string): Promise<any>Sends agetDataevent with the specifiedsyncTypeand waits for a response from the parent window. Supported types:'userInfo','groupInfo','robotInfo'.
