mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
receive user typing
This commit is contained in:
@@ -13,10 +13,11 @@ const { App } = Plugins;
|
||||
export class SignalRService {
|
||||
private connection: SignalRConnection;
|
||||
private messageSubject: BehaviorSubject<string> = new BehaviorSubject<any>(null);
|
||||
private typingSubject: BehaviorSubject<string> = new BehaviorSubject<any>(null);
|
||||
private connectingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(null);
|
||||
|
||||
constructor(
|
||||
private platform: Platform,) {
|
||||
private platform: Platform) {
|
||||
// this.startConnection();
|
||||
// this.addMessageListener();
|
||||
|
||||
@@ -58,6 +59,9 @@ export class SignalRService {
|
||||
this.connection.getMessages().subscribe((data) => {
|
||||
this.messageSubject.next(data)
|
||||
})
|
||||
this.connection.getTyping().subscribe((data) => {
|
||||
this.typingSubject.next(data)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,6 +72,10 @@ export class SignalRService {
|
||||
|
||||
}
|
||||
|
||||
getTyping() {
|
||||
return this.typingSubject.asObservable()
|
||||
}
|
||||
|
||||
async sendMessage(data: Object) {
|
||||
return await this.connection.sendMessage(data as any)
|
||||
}
|
||||
@@ -75,4 +83,8 @@ export class SignalRService {
|
||||
newConnection() {
|
||||
this.establishConnection()
|
||||
}
|
||||
|
||||
async sendTyping({ChatRoomId, UserName}) {
|
||||
return await this.connection.typing({ ChatRoomId, UserName})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user