mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
send and receive message
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { err, ok } from 'neverthrow';
|
||||
import { WebSocketMessage, WebSocketService } from '../../../infra/socket/socket';
|
||||
import { SignalRService } from '../../../infra/socket/signal-r.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MessageLiveDataSourceService {
|
||||
|
||||
constructor(
|
||||
public socket: WebSocketService,
|
||||
private signalR: SignalRService) {}
|
||||
|
||||
async sendMessage(data: WebSocketMessage) {
|
||||
|
||||
try {
|
||||
|
||||
const result = await this.socket.sendMessage(data).toPromise()
|
||||
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
return err(e)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user