connect to socket server

This commit is contained in:
Peter Maquiran
2022-01-07 09:03:15 +01:00
parent 73354e00af
commit 6e0b54c0cf
6 changed files with 185 additions and 3 deletions
@@ -0,0 +1,46 @@
import { Injectable } from '@angular/core';
import { SocketInterfaceService } from './interface/socket-interface.service'
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class RocketChatClientService {
private SocketInterfaceService = new SocketInterfaceService()
constructor() {
const url = environment.apiChatUrl.replace('https','wss')
// this.SocketInterfaceService.connect(url);
}
login(user) {
const loginRequest = {
msg: "method",
method: "login",
id: "42",
params: [
{
"user": { "username": user.username },
"password": {
"digest": user.password,
"algorithm":"sha-256"
}
}
]
}
// this.SocketInterfaceService.send(loginRequest)
}
logout(){ }
send(roomId, message, option) {}
receive() {}
joinRoom(){}
deleteMessage() {}
}
window['RocketChatClientService'] = new RocketChatClientService();