Compare commits

...
7 Commits
6 changed files with 65 additions and 9 deletions

No files matched your search

+11
View File
@@ -6,6 +6,17 @@ The format is based on [keep a changelog](http://keepachangelog.com/) and this p
## [Unreleased]
## [2.0.4] - 2020-01-23
### Added
- Updated gRPC, GSON and Lombok dependencies.
## [2.0.3] - 2019-10-25
### Added
- More ways to create a socket connection.
### Fixed
- Correctly decode UserPresence from payload.
## [2.0.2] - 2019-10-14
### Added
- Add support for session vars.
+6 -6
View File
@@ -36,7 +36,7 @@ plugins {
}
group = 'com.heroiclabs.nakama'
version = '2.0.2'
version = '2.0.4'
def description = 'Android optimized Java client for Nakama server.'
def gopath = System.getenv('GOPATH')
sourceCompatibility = 1.7
@@ -51,16 +51,16 @@ repositories {
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.2'
compile 'com.google.code.gson:gson:2.8.5'
compileOnly 'org.projectlombok:lombok:1.18.10'
compile 'com.google.code.gson:gson:2.8.6'
compile 'com.google.protobuf:protobuf-lite:3.0.1'
compile ('io.grpc:grpc-okhttp:1.14.0') {
compile ('io.grpc:grpc-okhttp:1.21.0') {
exclude group: 'com.squareup.okio', module:'okio'
}
compile 'com.squareup.okio:okio:1.14.0'
compile 'com.squareup.okhttp3:okhttp:3.11.0'
compile 'io.grpc:grpc-protobuf-lite:1.14.0'
compile 'io.grpc:grpc-stub:1.14.0'
compile 'io.grpc:grpc-protobuf-lite:1.21.0'
compile 'io.grpc:grpc-stub:1.21.0'
compile 'javax.annotation:javax.annotation-api:1.3.2'
compile ('com.google.api.grpc:googleapis-common-protos:0.0.3') {
exclude group: 'io.grpc', module:'grpc-protobuf'
@@ -33,10 +33,12 @@ public class Channel {
* The server-assigned channel ID.
*/
private String id;
/**
* The presences visible on the chat channel.
*/
private List<UserPresence> presences;
/**
* The presence of the current user. i.e. Your self.
*/
@@ -60,6 +60,33 @@ public interface Client {
*/
SocketClient createSocket(final int port, final int socketTimeoutMs);
/**
* Create a new socket from the client.
* @param host The host URL of the server.
* @param port The port number of the server. Default should be 7350.
* @return a new SocketClient instance.
*/
SocketClient createSocket(final String host, final int port);
/**
* Create a new socket from the client.
* @param host The host URL of the server.
* @param port The port number of the server. Default should be 7350.
* @param ssl Whether to use SSL to connect to the server.
* @return a new SocketClient instance.
*/
SocketClient createSocket(final String host, final int port, final boolean ssl);
/**
* Create a new socket from the client.
* @param host The host URL of the server.
* @param port The port number of the server. Default should be 7350.
* @param ssl Whether to use SSL to connect to the server.
* @param socketTimeoutMs Sets the connect, read and write timeout for new connections.
* @return a new SocketClient instance.
*/
SocketClient createSocket(final String host, final int port, final boolean ssl, final int socketTimeoutMs);
/**
* Add one or more friends by id.
* @param session The session of the user.
@@ -20,6 +20,7 @@ import com.google.common.io.BaseEncoding;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.*;
import com.heroiclabs.nakama.api.*;
import io.grpc.ManagedChannel;
@@ -143,7 +144,7 @@ public class DefaultClient implements Client {
final Session result = new DefaultSession(input.getToken(), input.getCreated());
return Futures.immediateFuture(result);
}
});
}, MoreExecutors.directExecutor());
}
@Override
@@ -166,11 +167,26 @@ public class DefaultClient implements Client {
return createSocket(port, 5000);
}
@Override
public SocketClient createSocket(final String host, final int port) {
return createSocket(host, port, ssl);
}
@Override
public SocketClient createSocket(final int port, final int socketTimeoutMs) {
return new WebSocketClient(host, port, ssl, socketTimeoutMs, this.trace);
}
@Override
public SocketClient createSocket(final String host, final int port, final boolean ssl) {
return new WebSocketClient(host, port, ssl, 5000, this.trace);
}
@Override
public SocketClient createSocket(final String host, final int port, final boolean ssl, final int socketTimeoutMs) {
return new WebSocketClient(host, port, ssl, socketTimeoutMs, this.trace);
}
@Override
public ListenableFuture<Empty> addFriends(@NonNull final Session session, @NonNull final String... ids) {
return getStub(session).addFriends(AddFriendsRequest.newBuilder().addAllIds(Arrays.asList(ids)).build());
@@ -46,7 +46,7 @@ public class MatchData {
/**
* Information on the user who sent the state change.
*/
private UserPresence userPresence;
private UserPresence presence;
/**
* Returns match data
@@ -62,5 +62,5 @@ public class MatchData {
/**
* True if this data was delivered reliably, false otherwise.
*/
private Boolean reliable;
private boolean reliable;
}