diff options
author | Chocobozzz <me@florianbigard.com> | 2023-08-17 08:59:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-08-17 08:59:21 +0200 |
commit | c380e3928517eb5311b38cf257816642617d7a33 (patch) | |
tree | 2ea9b70ebca16b5d109bcce98fe7f944dad89319 /packages/server-commands/src/socket/socket-io-command.ts | |
parent | a8ca6190fb462bf6eb5685cfc1d8ae444164a487 (diff) | |
parent | 3a4992633ee62d5edfbb484d9c6bcb3cf158489d (diff) | |
download | PeerTube-c380e3928517eb5311b38cf257816642617d7a33.tar.gz PeerTube-c380e3928517eb5311b38cf257816642617d7a33.tar.zst PeerTube-c380e3928517eb5311b38cf257816642617d7a33.zip |
Merge branch 'feature/esm-and-nx' into develop
Diffstat (limited to 'packages/server-commands/src/socket/socket-io-command.ts')
-rw-r--r-- | packages/server-commands/src/socket/socket-io-command.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/server-commands/src/socket/socket-io-command.ts b/packages/server-commands/src/socket/socket-io-command.ts new file mode 100644 index 000000000..9c18c2a1f --- /dev/null +++ b/packages/server-commands/src/socket/socket-io-command.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import { io } from 'socket.io-client' | ||
2 | import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js' | ||
3 | |||
4 | export class SocketIOCommand extends AbstractCommand { | ||
5 | |||
6 | getUserNotificationSocket (options: OverrideCommandOptions = {}) { | ||
7 | return io(this.server.url + '/user-notifications', { | ||
8 | query: { accessToken: options.token ?? this.server.accessToken } | ||
9 | }) | ||
10 | } | ||
11 | |||
12 | getLiveNotificationSocket () { | ||
13 | return io(this.server.url + '/live-videos') | ||
14 | } | ||
15 | |||
16 | getRunnersSocket (options: { | ||
17 | runnerToken: string | ||
18 | }) { | ||
19 | return io(this.server.url + '/runners', { | ||
20 | reconnection: false, | ||
21 | auth: { runnerToken: options.runnerToken } | ||
22 | }) | ||
23 | } | ||
24 | } | ||