mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 15:10:59 +00:00
Updates components to work with GCT
This commit is contained in:
@@ -5,8 +5,8 @@ import { WebsocketService } from './websocket/websocket.service';
|
||||
const CHAT_URL = 'ws://localhost:9050/ws';
|
||||
|
||||
export interface Message {
|
||||
author: string,
|
||||
message: string
|
||||
Event: string,
|
||||
data:object,
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@@ -19,8 +19,8 @@ export class ChatService {
|
||||
.map((response: MessageEvent): Message => {
|
||||
let data = JSON.parse(response.data);
|
||||
return {
|
||||
author: data.author,
|
||||
message: data.message
|
||||
Event: data.Event,
|
||||
data: data.data,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ export class WebsocketService {
|
||||
|
||||
private create(url): Rx.Subject<MessageEvent> {
|
||||
let ws = new WebSocket(url);
|
||||
|
||||
|
||||
let observable = Rx.Observable.create(
|
||||
(obs: Rx.Observer<MessageEvent>) => {
|
||||
ws.onmessage = obs.next.bind(obs);
|
||||
ws.onerror = obs.error.bind(obs);
|
||||
ws.onclose = obs.complete.bind(obs);
|
||||
ws.onclose = obs.complete.bind(obs);
|
||||
return ws.close.bind(ws);
|
||||
})
|
||||
let observer = {
|
||||
|
||||
Reference in New Issue
Block a user