uws from client SDK it does not work properly
Closed this issue · 1 comments
kattsushi commented
jonathan-casarrubias commented
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;
}