mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Added chat integration with socket.io
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WebsocketService } from './websocket.service';
|
||||
|
||||
describe('WebsocketService', () => {
|
||||
let service: WebsocketService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(WebsocketService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import * as io from 'socket.io-client';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Socket } from 'ngx-socket-io';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WebsocketService {
|
||||
|
||||
message = '';
|
||||
messages = [];
|
||||
currentUser = '';
|
||||
|
||||
constructor(private socket: Socket) { }
|
||||
|
||||
connect(){
|
||||
return this.socket.connect();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user