mirror of
https://github.com/grafana/grafana.git
synced 2026-08-19 01:34:54 -05:00
Live: check logged-in-user for grafana live (#27436)
This commit is contained in:
@@ -7,7 +7,7 @@ import Centrifuge, {
|
||||
SubscribeErrorContext,
|
||||
} from 'centrifuge/dist/centrifuge.protobuf';
|
||||
import SockJS from 'sockjs-client';
|
||||
import { GrafanaLiveSrv, setGrafanaLiveSrv, ChannelHandler } from '@grafana/runtime';
|
||||
import { GrafanaLiveSrv, setGrafanaLiveSrv, ChannelHandler, config } from '@grafana/runtime';
|
||||
import { Observable, Subject, BehaviorSubject } from 'rxjs';
|
||||
import { KeyValue } from '@grafana/data';
|
||||
|
||||
@@ -23,13 +23,10 @@ class CentrifugeSrv implements GrafanaLiveSrv {
|
||||
standardCallbacks: SubscriptionEvents;
|
||||
|
||||
constructor() {
|
||||
console.log('connecting....');
|
||||
// TODO: better pick this from the URL
|
||||
this.centrifuge = new Centrifuge(`http://${location.host}/live/sockjs`, {
|
||||
this.centrifuge = new Centrifuge(`${config.appUrl}live/sockjs`, {
|
||||
debug: true,
|
||||
sockjs: SockJS,
|
||||
});
|
||||
this.centrifuge.setToken('ABCD');
|
||||
this.centrifuge.connect(); // do connection
|
||||
this.connectionState = new BehaviorSubject<boolean>(this.centrifuge.isConnected());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user