Merge branch 'feature/websocket' of https://bitbucket.org/equilibriumito/gabinete-digital into feature/websocket

This commit is contained in:
tiago.kayaya
2022-01-14 15:07:43 +01:00
6 changed files with 51 additions and 30 deletions
+12
View File
@@ -23,6 +23,8 @@ export class RoomService {
private ToastService = ToastsService
scrollDown = () => {}
constructor(
public WsChatService: WsChatService,
private MessageService: MessageService,
@@ -52,6 +54,11 @@ export class RoomService {
this.lastMessage.msg = message.msg
this.calDateDuration(ChatMessage._updatedAt)
this.massages.push(message)
setTimeout(()=>{
this.scrollDown()
}, 100)
}
)
}
@@ -78,6 +85,11 @@ export class RoomService {
})
setTimeout(()=>{
this.scrollDown()
}, 50)
this.hasLoadHistory = true
}
+3 -25
View File
@@ -234,35 +234,13 @@ export class WsChatService {
}
/**
* @param roomId
* @param key
* @param funx
*/
receiveMyMessageConfirmation(roomId, funx: Function) {
this.ws.registerCallback({
type:'Onmessage',
funx:(message)=>{
if(message.msg =='result') {
if(message.result) {
if(message.result.msg) {
if(message.result.rid == roomId) {
funx(message)
}
}
}
}
}
})
}
receiveLiveMessageFromRoom(roomId, funx: Function) {
const key = roomId + funx;
this.ws.registerCallback({
type:'Onmessage',
key: key,
funx:(message)=>{
if(message.msg =='changed' && message.collection == 'stream-room-messages') {
if(message.fields.args[0].rid == roomId) {