0
각도 5 프로젝트에서 atmosphere.js를 사용해야합니다.Angular 5 and atmosphere.js
나는 다음 단계를 완료했습니다 :
npm install --save @types/atmosphere.js
npm install --save atmosphere.js
나는 서비스를 만들었습니다
import { Injectable } from '@angular/core';
import * as Rx from 'rxjs';
import * as Atmosphere from 'atmosphere.js';
import {Subject} from 'rxjs/Subject';
@Injectable()
export class WebsocketService {
public eventsSubject: Rx.Subject<any> = new Rx.Subject<any>();
private url:string = "http://localhost:4200/ws/register";
private socket: Atmosphere.Atmosphere;
private subSocket: any;
private request: Atmosphere.Request;
public dataStream: Subject<any> = new Subject<any>();
constructor() {
...
try {
this.subSocket = this.socket.subscribe(this.request);
} catch (e) {
console.log("Error: " + e);
}
}
하지만 소켓은 항상 정의되지 않습니다.
어디서 오류가 있습니까?
감사
위대한 작품입니다. tnx –