onixjs/sdk

uws from client SDK it does not work properly

Closed this issue · 1 comments

I'm having the following error when to instantiate the SDK client
alt text

Fixed:

New API:

import { OnixClient, AppReference} from "@onixjs/sdk";
import { Browser } from '@onixjs/sdk/dist/core/browser.adapters';
// Create SDK Instance (Hint: Use NodeJS Adapters for NodeJS Clients)
const SDK: OnixClient = new OnixClient({
    host: '127.0.0.1',
    port: 80,
    adapters: {
        http: Browser.HTTP,
        websocket: Browser.WebSocket
    }
});
// Init SDK
await SDK.init();
// Create a TodoApp Reference
const TodoAppRef: AppReference | Error = await SDK.AppReference('TodoApp');
// Verify we actually got a Reference and not an Error
if (TodoAppRef instanceof AppReference) {
    const result = await TodoAppRef.Module('TodoModule')
                                   .Component('TodoComponent')
                                   .Method('addTodo')
                                   .call({ text: 'Hello SDK World' });
} else {
    throw TodoAppRef;
}