Skip to content

Commit

Permalink
Lavalink Major Version Header (lavalink-devs#111)
Browse files Browse the repository at this point in the history
* add lavaclient to list of libs which support v3

* testing lavalink version header

* change Lavalink-Version to Lavalink-Major-Version

* update implementation file to make ppl aware of the change

* significant over breaking, removal of non breaking
  • Loading branch information
luaugg authored and freyacodes committed Jun 5, 2018
1 parent c425a01 commit 2121b39
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ The Java client has support for JDA, but can also be adapted to work with other
* Hixie 76
* Hixie 75

## Breaking changes v2.0 -> v3.0
The response of `/loadtracks` has been completely changed.
## Significant changes v2.0 -> v3.0
* The response of `/loadtracks` has been completely changed.
* Lavalink v3.0 now reports its version as a handshake response header.
`Lavalink-Major-Version` has a value of `3` for v3.0 only. It's missing for any older version.

## Breaking changes v1.3 -> v2.0
## Significant changes v1.3 -> v2.0
With the release of v2.0 many unnecessary ops were removed:

* `connect`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
/**
* Created by napster on 25.04.18.
*/

@Configuration
@SuppressWarnings("WeakerAccess")
public class SentryConfiguration {

private static final Logger log = LoggerFactory.getLogger(SentryConfiguration.class);
Expand Down
10 changes: 10 additions & 0 deletions LavalinkServer/src/main/java/lavalink/server/io/SocketServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
import net.dv8tion.jda.Core;
import net.dv8tion.jda.manager.AudioManager;
import org.java_websocket.WebSocket;
import org.java_websocket.drafts.Draft;
import org.java_websocket.exceptions.InvalidDataException;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.handshake.ServerHandshakeBuilder;
import org.java_websocket.server.WebSocketServer;
import org.json.JSONObject;
import org.slf4j.Logger;
Expand Down Expand Up @@ -76,6 +79,13 @@ public void start() {
super.start();
}

@Override
public ServerHandshakeBuilder onWebsocketHandshakeReceivedAsServer(WebSocket conn, Draft draft, ClientHandshake request) throws InvalidDataException {
ServerHandshakeBuilder builder = super.onWebsocketHandshakeReceivedAsServer(conn, draft, request);
builder.put("Lavalink-Major-Version", "3");
return builder;
}

@Override
public void onOpen(WebSocket webSocket, ClientHandshake clientHandshake) {
try {
Expand Down

0 comments on commit 2121b39

Please sign in to comment.