SDK For Data Streaming
Angular
4min
install the sdk with npm npm install save @deerden/qualeticssdk; since webpack 5 no longer includes polyfills for the node js core modules, they need to be added to webpack configuration this is done by first installing @angular builders/custom webpack and node polyfill webpack plugin packages npm install save dev @angular builders/custom webpack npm install save dev node polyfill webpack plugin then angular json file needs to be edited, from that file, first locate line containing "builder" "@angular devkit/build angular\ browser" and replace it with "builder" "@angular builders/custom webpack\ browser" then inside architect build options add following property "customwebpackconfig" { "path" " /custom webpack config js" }, to have the custom webpack configuration to be used also by the development server, locale also following line "builder" "@angular devkit/build\ dev server" and replace it with "builder" "@angular builders/custom webpack\ dev server" next create a file called custom webpack config js and addi it to the project root after creating the file, add the following content to that file const nodepolyfillplugin = require("node polyfill webpack plugin") module exports = { plugins \[ new nodepolyfillplugin() ] }; now sdk should work in angular module import { component } from '@angular/core'; import { qualeticsservice } from "@deerden/qualeticssdk"; @component({ selector 'example component', templateurl ' /example component html', styleurls \[' /example component css'] }) export class examplecomponent { applicationid = "application id"; applicationsecret = "application secret"; clientid = "client id"; qualetics = new qualeticsservice(this applicationid, this applicationsecret, this clientid, true, { host 'wss\ //api qualetics com', port 443, appversion "1 0 0" }); ngoninit() { this qualetics init(); } sendmessage() { this qualetics send({ "actor" { "type" "user", "id" "js1234" }, "action" { "type" "buttonclick" }, "context" { "type" "button", "name" "button1" } }); } }