You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: IMPLEMENTATION.md
+46-8Lines changed: 46 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ User-Id: The user id of the bot you are playing music with
52
52
```
53
53
54
54
### Outgoing messages
55
-
Provide an intercepted voice server update. This causes the server to connect to the voice channel
55
+
Provide an intercepted voice server update. This causes the server to connect to the voice channel.
56
56
```json
57
57
{
58
58
"op": "voiceUpdate",
@@ -65,13 +65,15 @@ Provide an intercepted voice server update. This causes the server to connect to
65
65
Cause the player to play a track.
66
66
`startTime` is an optional setting that determines the number of milliseconds to offset the track by. Defaults to 0.
67
67
`endTime` is an optional setting that determines at the number of milliseconds at which point the track should stop playing. Helpful if you only want to play a snippet of a bigger track. By default the track plays until it's end as per the encoded data.
68
+
`noReplace` if set to true, this operation will be ignored if a track is already playing or paused.
68
69
```json
69
70
{
70
71
"op": "play",
71
72
"guildId": "...",
72
73
"track": "...",
73
74
"startTime": "60000",
74
-
"endTime": "120000"
75
+
"endTime": "120000",
76
+
"noReplace": false
75
77
}
76
78
```
77
79
@@ -139,9 +141,8 @@ and you can send the same VOICE_SERVER_UPDATE to a new node.
See [LavalinkSocket.java](https://github.com/FredBoat/Lavalink-Client/blob/master/src/main/java/lavalink/client/io/LavalinkSocket.java) for client implementation
145
146
146
147
Position information about a player. Includes unix timestamp.
147
148
```json
@@ -156,6 +157,7 @@ Position information about a player. Includes unix timestamp.
156
157
```
157
158
158
159
A collection of stats sent every minute.
160
+
159
161
```json
160
162
{
161
163
"op": "stats",
@@ -309,10 +311,46 @@ Additionally, in every `/loadtracks` response, a `loadType` property is returned
309
311
310
312
All REST responses from Lavalink include a `Lavalink-Api-Version` header.
311
313
314
+
### Resuming Lavalink sessions
315
+
316
+
What happens after your client disconnects is dependent on whether or not the session has been configured for resuming.
317
+
318
+
* If resuming is disabled all voice connections are closed immediately.
319
+
* If resuming is enabled all music will continue playing. You will then be able to resume your session, allowing you to control the players again.
320
+
321
+
To enable resuming, you must send a `configureResuming` message.
322
+
323
+
*`key` is the string you will need to send when resuming the session. Set to null to disable resuming altogether. Defaults to null.
324
+
*`timeout` is the number of seconds after disconnecting before the session is closed anyways. This is useful for avoiding accidental leaks. Defaults to `60` (seconds).
325
+
326
+
```json
327
+
{
328
+
"op": "configureResuming",
329
+
"key": "myResumeKey",
330
+
"timeout": 60
331
+
}
332
+
```
333
+
334
+
To resume a session, specify the resume key in your WebSocket handshake request headers:
335
+
336
+
```
337
+
Resume-Key: The resume key of the session you want to resume.
338
+
```
339
+
340
+
You can tell if your session was resumed by looking at the handshake response header `Session-Resumed` which is either `true` or `false`:
341
+
342
+
```
343
+
Session-Resumed: true
344
+
```
345
+
346
+
When a session is paused, any events that would normally have been sent is queued up. When the session is resumed, this
347
+
queue is then emptied and the events are then replayed.
348
+
312
349
### Special notes
313
-
* When your shard's mainWS connection dies, so does all your lavalink audio connections.
314
-
* This also includes resumes
315
-
* When a client connection to Lavalink-Server disconnects, all connections and players for that session are shut down.
350
+
351
+
* When your shard's main WS connection dies, so does all your lavalink audio connections.
352
+
* This also includes resumes
353
+
316
354
* If Lavalink-Server suddenly dies (think SIGKILL) the client will have to terminate any audio connections by sending this event:
0 commit comments