Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux committed Jun 26, 2019
1 parent 1d6c6b1 commit 09279f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ui/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
header_upstream Authorization {>Authorization}
header_upstream Session-Token {>Session-Token}
}
}
}
23 changes: 6 additions & 17 deletions ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { bufferTime, filter, map, mergeMap } from 'rxjs/operators';
import { Subscription } from 'rxjs/Subscription';
import { WebSocketSubject } from 'rxjs/webSocket';
import * as format from 'string-format-obj';
import { environment } from '../environments/environment';
import { AppService } from './app.service';
Expand All @@ -21,7 +22,6 @@ import { ToastService } from './shared/toast/ToastService';
import { CDSSharedWorker } from './shared/worker/shared.worker';
import { CDSWebWorker } from './shared/worker/web.worker';
import { CDSWorker } from './shared/worker/worker';
import { WebSocketSubject } from 'rxjs/webSocket';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -98,7 +98,7 @@ export class AppComponent implements OnInit {
} else {
this.isConnected = true;
this.startSSE();
this.startWebSocket2();
this.startWebSocket();
}
this.startVersionWorker();
});
Expand Down Expand Up @@ -150,26 +150,15 @@ export class AppComponent implements OnInit {
}
}

startWebSocket2(): void {
let exampleSocket = new WebSocket("ws://127.0.0.1:8081/ws", this._authStore.getUser().token);
exampleSocket.onopen = function (event) {
console.log('Connected', event);
};


}

startWebSocket(): void {
let url = (environment.apiURL + '/ws').replace('https', 'wss');
url = url.replace('http', 'ws');
let conf = {
url: 'ws://127.0.0.1:8081/ws',
protocol: this._authStore.getUser().token,
headers: {
"ee": "df"
},
url: url
};

this.websocket = new WebSocketSubject(conf);
this.websocket.subscribe((message)=> {
this.websocket.retry().subscribe((message) => {
console.log(message);
}, (err) => {
console.error(err)
Expand Down

0 comments on commit 09279f6

Please sign in to comment.