diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index a56568a49..ae7b96698 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -100,9 +100,11 @@ export class HomePage implements OnInit { this.RocketChatClientService.connect(()=>{ this.RocketChatClientService.login({ - username: 'paulo.pinto@gabinetedigital.local', + username: 'paulo.pinto', + email: 'paulo.pinto@gabinetedigital.local', password: 'tabteste@006' }) + }) // this.RocketChatClientService.send() diff --git a/src/app/services/socket/rocket-chat-client.service.ts b/src/app/services/socket/rocket-chat-client.service.ts index 37a49879b..297111bf3 100644 --- a/src/app/services/socket/rocket-chat-client.service.ts +++ b/src/app/services/socket/rocket-chat-client.service.ts @@ -34,6 +34,10 @@ class _RocketChatClientService { if(this.hasPing == false) { // first ping firstPingFunx() + + setTimeout(()=>{ + this.getRooms() + }, 5000) this.hasPing = true } } @@ -51,11 +55,8 @@ class _RocketChatClientService { id: requestId, params: [ { - "user": { "username": user.username }, - "password": { - "digest": user.password, - "algorithm":"sha-256" - } + user: { username: user.username }, + password: user.password } ] } @@ -85,13 +86,21 @@ class _RocketChatClientService { return requestId; } - receive() {} + subtribe() {} joinRoom(){} deleteMessage() {} createRoom() {} getRooms() { + const requestId = uuidv4() + const request = { + "msg": "method", + "method": "rooms/get", + "id": requestId, + "params": [ { "$date": 1480377601 } ] + } + this.ws.send(request, requestId) } @@ -116,10 +125,10 @@ class _RocketChatClientService { // socket class ================================================================== private socket!: WebSocket; private wsUrl = '' - wsMsgQueue : msgQueue[] = [] + private wsMsgQueue : msgQueue[] = [] private wsCallbacks: {[key: string]: wsCallbacksParams} = {} - ws = { + private ws = { connected: false, registerCallback:(params: wsCallbacksParams) =>{