mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
save
This commit is contained in:
@@ -20,8 +20,8 @@ export class ChatService {
|
||||
X_User_Id:any;
|
||||
X_Auth_Token:any;
|
||||
|
||||
SERVER_URL = 'wss://www.tabularium.pt/websocket';
|
||||
public messages: Subject<any>;
|
||||
//SERVER_URL = 'wss://www.tabularium.pt/websocket';
|
||||
//public messages: Subject<any>;
|
||||
loggedUserChat:any;
|
||||
|
||||
constructor(
|
||||
@@ -30,7 +30,7 @@ export class ChatService {
|
||||
private authService: AuthService,
|
||||
private storage: Storage,
|
||||
private storageService:StorageService,
|
||||
private wsService: WebsocketService,
|
||||
//private wsService: WebsocketService,
|
||||
)
|
||||
{
|
||||
this.loggedUserChat = authService.ValidatedUserChat;
|
||||
@@ -41,13 +41,13 @@ export class ChatService {
|
||||
headers: this.headers,
|
||||
};
|
||||
|
||||
this.messages = <Subject<any>>this.wsService.connect(this.SERVER_URL).map((response: MessageEvent): any => {
|
||||
/* this.messages = <Subject<any>>this.wsService.connect(this.SERVER_URL).map((response: MessageEvent): any => {
|
||||
let data = JSON.parse(response.data);
|
||||
console.log(data);
|
||||
return (JSON.stringify(data));
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
|
||||
getAllChannels(){
|
||||
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
|
||||
}
|
||||
@@ -61,17 +61,17 @@ export class ChatService {
|
||||
getRoomInfo(roomId:any){
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'rooms.info', opts);
|
||||
|
||||
|
||||
}
|
||||
customsRooms(params:any){
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'rooms.get', opts);
|
||||
}
|
||||
@@ -95,22 +95,22 @@ export class ChatService {
|
||||
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'im.history', opts);
|
||||
}
|
||||
|
||||
sendMessage(body:any){
|
||||
let opts = {
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
|
||||
}
|
||||
leaveRoom(body:any){
|
||||
let opts = {
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'rooms.leave', body, opts);
|
||||
@@ -120,15 +120,15 @@ export class ChatService {
|
||||
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'im.members', opts);
|
||||
}
|
||||
removeChatRoom(body:any){
|
||||
let opts = {
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'im.close', body, this.options);
|
||||
@@ -139,10 +139,10 @@ export class ChatService {
|
||||
getDirectMessage(roomId:string){
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'im.messages', opts);
|
||||
}
|
||||
@@ -155,10 +155,10 @@ export class ChatService {
|
||||
let params = new HttpParams();
|
||||
let url=environment.apiChatUrl+'groups.members';
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(url, opts);
|
||||
}
|
||||
@@ -166,10 +166,10 @@ export class ChatService {
|
||||
let params = new HttpParams();
|
||||
let url=environment.apiChatUrl+'channels.members';
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(url, opts);
|
||||
}
|
||||
@@ -178,20 +178,20 @@ export class ChatService {
|
||||
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'groups.history', opts);
|
||||
}
|
||||
getPublicGroupMessages(roomId:any){
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'channels.history', opts);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ export class ChatService {
|
||||
return this.http.post(environment.apiChatUrl+'channels.leave', body, this.options);
|
||||
}
|
||||
removeChannelMember(body:any){
|
||||
let opts = {
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'channels.kick', body, opts);
|
||||
@@ -225,10 +225,10 @@ export class ChatService {
|
||||
getGroupInfo(roomId:any){
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
}
|
||||
return this.http.get(environment.apiChatUrl+'groups.info', opts);
|
||||
}
|
||||
@@ -236,7 +236,7 @@ export class ChatService {
|
||||
return this.http.post(environment.apiChatUrl+'groups.rename', body, this.options);
|
||||
}
|
||||
removeGroupMember(body:any){
|
||||
let opts = {
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'groups.kick', body, opts);
|
||||
|
||||
@@ -25,7 +25,7 @@ export class WebsocketService {
|
||||
let ws = new WebSocket(url);
|
||||
|
||||
console.log(ws);
|
||||
|
||||
|
||||
|
||||
let observable = Rx.Observable.create((obs: Rx.Observer<MessageEvent>) => {
|
||||
ws.onmessage = obs.next.bind(obs);
|
||||
|
||||
Reference in New Issue
Block a user