aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-10-02 16:57:34 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-10-02 16:57:34 -0500
commitd6a83e4a8c1b5c9971819a5d4287d8a03889d70c (patch)
tree06192c3606421657f4ddd7f5b7c613dc271b4392 /src
parent96c5fd0a75d2d17b202f0d19803b63b501fbda95 (diff)
downloadslskd-d6a83e4a8c1b5c9971819a5d4287d8a03889d70c.tar.gz
add hubFactory
Diffstat (limited to 'src')
-rw-r--r--src/web/src/lib/hubFactory.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/web/src/lib/hubFactory.js b/src/web/src/lib/hubFactory.js
new file mode 100644
index 00000000..f03d89a0
--- /dev/null
+++ b/src/web/src/lib/hubFactory.js
@@ -0,0 +1,18 @@
+import {
+ JsonHubProtocol,
+ HubConnectionBuilder,
+ LogLevel
+} from '@microsoft/signalr'
+
+import { rootUrl } from '../config';
+import * as session from '../lib/session';
+
+export const createApplicationHubConnection = () =>
+ new HubConnectionBuilder()
+ .withUrl(`${rootUrl}/hub/application`, {
+ accessTokenFactory: session.getToken
+ })
+ .withAutomaticReconnect()
+ .withHubProtocol(new JsonHubProtocol())
+ .configureLogging(LogLevel.Information)
+ .build(); \ No newline at end of file