mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
improve rocket-chat-cliente interface
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SocketInterfaceService } from './interface/socket-interface.service'
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -9,16 +10,25 @@ export class RocketChatClientService {
|
||||
|
||||
private SocketInterfaceService = new SocketInterfaceService()
|
||||
|
||||
constructor() {
|
||||
const url = environment.apiChatUrl.replace('https','wss')
|
||||
// this.SocketInterfaceService.connect(url);
|
||||
constructor() {}
|
||||
|
||||
connect(url = 'wss://gabinetedigitalchat.dyndns.info/websocket') {
|
||||
|
||||
this.SocketInterfaceService.connect(url);
|
||||
|
||||
const connectMessage = {
|
||||
msg: "connect",
|
||||
version: "1",
|
||||
support: ["1"]
|
||||
}
|
||||
this.SocketInterfaceService.send(connectMessage)
|
||||
}
|
||||
|
||||
login(user) {
|
||||
const loginRequest = {
|
||||
msg: "method",
|
||||
method: "login",
|
||||
id: "42",
|
||||
id: uuidv4(),
|
||||
params: [
|
||||
{
|
||||
"user": { "username": user.username },
|
||||
@@ -29,17 +39,31 @@ export class RocketChatClientService {
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
// this.SocketInterfaceService.send(loginRequest)
|
||||
this.SocketInterfaceService.send(loginRequest)
|
||||
}
|
||||
|
||||
logout(){ }
|
||||
|
||||
send(roomId, message, option) {}
|
||||
send(roomId, message, option) {
|
||||
var request = {
|
||||
"msg": "method",
|
||||
"method": "sendMessage",
|
||||
"id": uuidv4(),
|
||||
"params": [{
|
||||
"_id": "message-id",
|
||||
"rid": "room-id",
|
||||
"msg": "Hello World!"
|
||||
}]
|
||||
}
|
||||
|
||||
this.SocketInterfaceService.send(request);
|
||||
}
|
||||
|
||||
receive() {}
|
||||
joinRoom(){}
|
||||
deleteMessage() {}
|
||||
|
||||
createRoom() {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user