
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
ngxi4-socket-client
Advanced tools
This library was generated by Doan Quoc Cuong (cuongdq.payment@gmail.com)
This library was generated by Doan Quoc Cuong (cuongdq.payment@gmail.com)
npm install ngxi4-socket-client --save
npm install ngx-device-detector ngx-socket-io --save
npm install ngxi4-dynamic-service --save
# And install all extra of ngxi4-dynamic-service (search for help of this library)
npm install croppie crypto-js exif-js simple-crypto-js --save
npm install ngx-barcode@0.2.4 ngx-image-cropper ngx-qrcode2@0.0.9 ngx-webcam@0.2.6 --save
# version "ng-multiselect-dropdown": "^0.2.10"
# npm i ng-multiselect-dropdown@latest
npm install @ionic/angular@4.7.1 ng-multiselect-dropdown@0.2.10
npm install @ionic-native/sqlite --save
# version của angular for event
# error import { EventHandler } from '@ionic/angular/dist/providers/events'
# npm install angular-webstorage-service@latest
# Error: angular-webstorage-service/src/storage-service.module.d.ts:9:22 - error NG6002: Appears in the NgModule.imports of
# npm un angular-webstorage-service --save
npm i ngx-webstorage-service --save
npm install ngx-qrcode2@latest
http://travistidwell.com/jsencrypt/
<!-- Save in src/assets/js/jsencrypt.js -->
{
"projects": {
"app": {
// ...
"architect": {
"build": {
// ...
"scripts": [
"src/assets/js/jsencrypt.js"
// ,"src/assets/js/communicate2Angular.js"
]
// ...
},
// ...
}
}
},
// ...
}
import { Ngxi4SocketClientModule } from 'ngxi4-socket-client'
@NgModule({
// ...
imports: [
// ....
// add module ngxi4-socket-client
Ngxi4SocketClientModule.forRoot()
// or
// Ngxi4SocketClientModule.forRoot(
// {
// APP_NAME: "YOUR-APP-NAME"
// , SERVER_URL: "your socket-server"
// , SOCKET_PATH: "your socket-path"
// , PING_INTERVAL: 1000
// , TIME_OUT: 60000
// , RECONNECT_DELAY: undefined
// , RECONNECT_DELAY_MAX: undefined
// }
)
]
})
import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { ApiSocketService } from './services/api-socket.service';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private apiSocket: ApiSocketService
) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
this.init();
});
}
init() {
this.apiSocket.init()
// or
// this.apiSocket.init(
// server_url?: string
// , socket_path?: string
// , ping_interval?: number
// , time_out?: number
// , reconnect_delay?: number
// , reconnect_delay_max?: number
// , appName?: any // tên ứng dụng nếu có
// , extraEvents?: any // sự kiện thêm vào không phải mặc định
// , callback?: any
// )
// NOTE: if input by this param --> the config in module (1.) is replaced
}
}
import { Component, HostListener } from '@angular/core';
import { CommonsService } from 'ngxi4-dynamic-service';
import { ApiSocketService } from '../services/api-socket.service';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
isMobile: boolean = false;
socketConnection: any;
@HostListener('window:resize', ['$event'])
onResize(event) {
this.isMobile = event.target.innerWidth < 576;
}
constructor(
private apiCommon: CommonsService
, private apiSocket: ApiSocketService
) { this.init() }
init() {
this.isMobile = this.apiCommon.isMobile()
this.socketConnection = this.apiSocket.getConnection();
}
onClickUser() {
if (this.socketConnection.userInfo) {
// hiển thị thông tin của userInfo đã kết nối vào
// view form chứa user info này
// console.log('Thông tin user', this.socketConnection.userInfo);
// gửi lệnh lên server kiểm tra có bao nhiêu socket đang nối với user này
// ở những máy tính nào
this.apiSocket.sendSocketIo("client-req-command", { command: "GET-MY-USER" })
} else {
this.apiSocket.sendSocketIo("client-req-command", { command: "LOGIN" })
}
}
onClickDevice() {
if (this.socketConnection.device_online) {
// hiển thị thông tin của userInfo đã kết nối vào
// view form chứa user info này
// console.log('Thông tin thiết bị', this.socketConnection.device_id);
// gửi thông tin lên máy chủ, xem có bao nhiêu socket đang dùng bộ key với device_id này
// máy chủ trả về form thông tin thiết bị đang nối ở những device nào
this.apiSocket.sendSocketIo("client-req-command", { command: "GET-MY-DEVICE" })
}
}
}
FAQs
This library was generated by Doan Quoc Cuong (cuongdq.payment@gmail.com)
The npm package ngxi4-socket-client receives a total of 0 weekly downloads. As such, ngxi4-socket-client popularity was classified as not popular.
We found that ngxi4-socket-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.