receive user typing

This commit is contained in:
Peter Maquiran
2024-07-17 16:39:18 +01:00
parent 0312df88e8
commit cf6fe3a4c8
17 changed files with 424 additions and 33 deletions
@@ -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})
}
}