mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
save
This commit is contained in:
@@ -72,6 +72,16 @@ export class ChatPage implements OnInit {
|
||||
@Output() getRoomInfo;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Websockets variables
|
||||
|
||||
*/
|
||||
|
||||
SERVER_URL = 'wss://www.tabularium.pt/websocket';
|
||||
ws:any;
|
||||
|
||||
/* Fim websockets variables*/
|
||||
constructor(
|
||||
private http:HttpClient,
|
||||
private chatService: ChatService,
|
||||
@@ -100,9 +110,47 @@ export class ChatPage implements OnInit {
|
||||
})
|
||||
|
||||
console.log(this.roomId);
|
||||
this.connect();
|
||||
|
||||
}
|
||||
|
||||
/* websocket functions */
|
||||
connect() {
|
||||
this.ws = new WebSocket(this.SERVER_URL, []);
|
||||
console.log(this.ws);
|
||||
|
||||
/* this.ws.onmessage = handleMessageReceived;
|
||||
this.ws.onerror = handleError; */
|
||||
}
|
||||
handleMessageReceived(data) {
|
||||
// Simply call logMessage(), passing the received data.
|
||||
/* logMessage(data.data); */
|
||||
}
|
||||
handleConnected(data) {
|
||||
// Create a log message which explains what has happened and includes
|
||||
// the url we have connected too.
|
||||
var logMsg = 'Connected to server: ' + data.target.url;
|
||||
// Add the message to the log.
|
||||
/* logMessage(logMsg) */
|
||||
}
|
||||
handleError(err) {
|
||||
// Print the error to the console so we can debug it.
|
||||
console.log("Error: ", err);
|
||||
}
|
||||
logMessage(msg) {
|
||||
// $apply() ensures that the elements on the page are updated
|
||||
// with the new message.
|
||||
/* $scope.$apply(function() { */
|
||||
//Append out new message to our message log. The \n means new line.
|
||||
/* $scope.messageLog = $scope.messageLog + msg + "\n"; */
|
||||
// Update the scrolling (defined below).
|
||||
/*updateScrolling();*/
|
||||
/* S */
|
||||
}
|
||||
|
||||
|
||||
/* Fim websockets functions */
|
||||
|
||||
closeAllDesktopComponents() {
|
||||
this.showMessages=false;
|
||||
this.showContacts=false;
|
||||
|
||||
Reference in New Issue
Block a user