public class WebSocketClient extends java.lang.Object implements SocketClient
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PING_MS |
static int |
DEFAULT_TIMEOUT_MS |
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
acceptParty(@NonNull java.lang.String partyId,
UserPresence userPresence)
Accept a member to a party.
|
com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> |
addMatchmaker()
Join the matchmaker pool and search for opponents on the server.
|
com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> |
addMatchmaker(int minCount)
Join the matchmaker pool and search for opponents on the server.
|
com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> |
addMatchmaker(int minCount,
int maxCount)
Join the matchmaker pool and search for opponents on the server.
|
com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> |
addMatchmaker(int minCount,
int maxCount,
java.lang.String query)
Join the matchmaker pool and search for opponents on the server.
|
com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> |
addMatchmaker(int minCount,
int maxCount,
java.lang.String query,
java.util.Map<java.lang.String,java.lang.String> stringProperties)
Join the matchmaker pool and search for opponents on the server.
|
com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> |
addMatchmaker(int minCount,
int maxCount,
java.lang.String query,
java.util.Map<java.lang.String,java.lang.String> stringProperties,
java.util.Map<java.lang.String,java.lang.Double> numericProperties)
Join the matchmaker pool and search for opponents on the server.
|
com.google.common.util.concurrent.ListenableFuture<PartyMatchmakerTicket> |
addPartyMatchmaker(@NonNull java.lang.String partyId,
int minCount,
int maxCount,
@NonNull java.lang.String query,
java.util.Map<java.lang.String,java.lang.String> stringProperties,
java.util.Map<java.lang.String,java.lang.Double> numericProperties,
int countMultiple)
Begin matchmaking as a party.
|
com.google.common.util.concurrent.ListenableFuture<Party> |
closeParty(@NonNull java.lang.String partyId)
End a party.
|
com.google.common.util.concurrent.ListenableFuture<Session> |
connect(@NonNull Session session,
@NonNull SocketListener listener)
Connect to the server.
|
com.google.common.util.concurrent.ListenableFuture<Session> |
connect(@NonNull Session session,
@NonNull SocketListener listener,
boolean createStatus)
Connect to the server.
|
com.google.common.util.concurrent.ListenableFuture<Match> |
createMatch()
Create a multiplayer match on the server.
|
com.google.common.util.concurrent.ListenableFuture<Party> |
createParty(boolean open,
int maxSize)
Create a party.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Boolean> |
disconnect()
Close the connection with the server.
|
com.google.common.util.concurrent.ListenableFuture<Status> |
followUsers(java.util.List<java.lang.String> userIds,
java.lang.String... usernames)
Follow one or more users for status updates.
|
com.google.common.util.concurrent.ListenableFuture<Status> |
followUsers(java.lang.String... userIds)
Follow one or more users for status updates.
|
com.google.common.util.concurrent.ListenableFuture<Channel> |
joinChat(@NonNull java.lang.String target,
@NonNull ChannelType type)
Join a chat channel on the server.
|
com.google.common.util.concurrent.ListenableFuture<Channel> |
joinChat(@NonNull java.lang.String target,
@NonNull ChannelType type,
boolean persistence)
Join a chat channel on the server.
|
com.google.common.util.concurrent.ListenableFuture<Channel> |
joinChat(@NonNull java.lang.String target,
@NonNull ChannelType type,
boolean persistence,
boolean hidden)
Join a chat channel on the server.
|
com.google.common.util.concurrent.ListenableFuture<Match> |
joinMatch(@NonNull java.lang.String matchId)
Join a multiplayer match by ID.
|
com.google.common.util.concurrent.ListenableFuture<Match> |
joinMatch(java.lang.String matchId,
java.util.Map<java.lang.String,java.lang.String> metadata)
Join a multiplayer match by ID.
|
com.google.common.util.concurrent.ListenableFuture<Match> |
joinMatchToken(@NonNull java.lang.String token)
Join a multiplayer match with a matchmaker.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
joinParty(@NonNull java.lang.String partyId)
Join a party.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
leaveChat(@NonNull java.lang.String channelId)
Leave a chat channel on the server.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
leaveMatch(@NonNull java.lang.String matchId)
Leave a match on the server.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
leaveParty(@NonNull java.lang.String partyId)
Leave a party.
|
com.google.common.util.concurrent.ListenableFuture<PartyJoinRequest> |
listPartyJoinRequest(@NonNull java.lang.String partyId)
Lists pending join requests for a party.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
promoteParty(@NonNull java.lang.String partyId,
UserPresence userPresence)
Promote a member to party leader.
|
com.google.common.util.concurrent.ListenableFuture<ChannelMessageAck> |
removeChatMessage(@NonNull java.lang.String channelId,
@NonNull java.lang.String messageId)
Remove a chat message from a channel on the server.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
removeMatchmaker(@NonNull java.lang.String ticket)
Leave the matchmaker pool by ticket.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
removeParty(@NonNull java.lang.String partyId,
UserPresence userPresence)
Remove/reject a member from a party.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
removePartyMatchmaker(@NonNull java.lang.String partyId,
@NonNull java.lang.String ticket)
Cancel a party matchmaking process using a ticket.
|
com.google.common.util.concurrent.ListenableFuture<Rpc> |
rpc(@NonNull java.lang.String id)
Send an RPC message to the server.
|
com.google.common.util.concurrent.ListenableFuture<Rpc> |
rpc(@NonNull java.lang.String id,
java.lang.String payload)
Send an RPC message to the server.
|
void |
sendMatchData(@NonNull java.lang.String matchId,
long opCode,
@NonNull byte[] data)
Send a state change to a match on the server.
|
void |
sendMatchData(@NonNull java.lang.String matchId,
long opCode,
@NonNull byte[] data,
UserPresence... presences)
Send a state change to a match on the server.
|
void |
sendPartyData(@NonNull java.lang.String partyId,
int opCode,
@NonNull byte[] data)
Send party data.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
unfollowUsers(java.lang.String... userIds)
Unfollow status updates for one or more users.
|
com.google.common.util.concurrent.ListenableFuture<ChannelMessageAck> |
updateChatMessage(@NonNull java.lang.String channelId,
@NonNull java.lang.String messageId,
@NonNull java.lang.String content)
Update a chat message to a channel on the server.
|
com.google.common.util.concurrent.ListenableFuture<java.lang.Void> |
updateStatus(java.lang.String status)
Update the user's status online.
|
com.google.common.util.concurrent.ListenableFuture<ChannelMessageAck> |
writeChatMessage(@NonNull java.lang.String channelId,
@NonNull java.lang.String content)
Send a chat message to a channel on the server.
|
public static final int DEFAULT_TIMEOUT_MS
public static final int DEFAULT_PING_MS
public com.google.common.util.concurrent.ListenableFuture<Session> connect(@NonNull @NonNull Session session, @NonNull @NonNull SocketListener listener)
SocketClient
connect
in interface SocketClient
session
- The session of the user.listener
- An event listener to notify on updates.public com.google.common.util.concurrent.ListenableFuture<Session> connect(@NonNull @NonNull Session session, @NonNull @NonNull SocketListener listener, boolean createStatus)
SocketClient
connect
in interface SocketClient
session
- The session of the user.listener
- An event listener to notify on updates.createStatus
- True if the socket should show the user as online to others.public com.google.common.util.concurrent.ListenableFuture<java.lang.Boolean> disconnect()
SocketClient
disconnect
in interface SocketClient
public com.google.common.util.concurrent.ListenableFuture<Channel> joinChat(@NonNull @NonNull java.lang.String target, @NonNull @NonNull ChannelType type)
SocketClient
joinChat
in interface SocketClient
target
- The target channel to join.type
- The type of channel to join.public com.google.common.util.concurrent.ListenableFuture<Channel> joinChat(@NonNull @NonNull java.lang.String target, @NonNull @NonNull ChannelType type, boolean persistence)
SocketClient
joinChat
in interface SocketClient
target
- The target channel to join.type
- The type of channel to join.persistence
- True if chat messages should be stored.public com.google.common.util.concurrent.ListenableFuture<Channel> joinChat(@NonNull @NonNull java.lang.String target, @NonNull @NonNull ChannelType type, boolean persistence, boolean hidden)
SocketClient
joinChat
in interface SocketClient
target
- The target channel to join.type
- The type of channel to join.persistence
- True if chat messages should be stored.hidden
- True if the user should be hidden on the channel.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> leaveChat(@NonNull @NonNull java.lang.String channelId)
SocketClient
leaveChat
in interface SocketClient
channelId
- The channel to leave.public com.google.common.util.concurrent.ListenableFuture<ChannelMessageAck> removeChatMessage(@NonNull @NonNull java.lang.String channelId, @NonNull @NonNull java.lang.String messageId)
SocketClient
removeChatMessage
in interface SocketClient
channelId
- The chat channel with the message.messageId
- The ID of a chat message to update.public com.google.common.util.concurrent.ListenableFuture<ChannelMessageAck> writeChatMessage(@NonNull @NonNull java.lang.String channelId, @NonNull @NonNull java.lang.String content)
SocketClient
writeChatMessage
in interface SocketClient
channelId
- The channel to send on.content
- The content of the chat message.public com.google.common.util.concurrent.ListenableFuture<ChannelMessageAck> updateChatMessage(@NonNull @NonNull java.lang.String channelId, @NonNull @NonNull java.lang.String messageId, @NonNull @NonNull java.lang.String content)
SocketClient
updateChatMessage
in interface SocketClient
channelId
- The ID of the chat channel with the message.messageId
- The ID of the message to update.content
- The content update for the message.public com.google.common.util.concurrent.ListenableFuture<Match> createMatch()
SocketClient
createMatch
in interface SocketClient
public com.google.common.util.concurrent.ListenableFuture<Match> joinMatch(@NonNull @NonNull java.lang.String matchId)
SocketClient
joinMatch
in interface SocketClient
matchId
- A match ID.public com.google.common.util.concurrent.ListenableFuture<Match> joinMatch(java.lang.String matchId, java.util.Map<java.lang.String,java.lang.String> metadata)
SocketClient
joinMatch
in interface SocketClient
matchId
- A match ID.metadata
- An optional set of key-value metadata pairs to be passed to the match handler, if any.public com.google.common.util.concurrent.ListenableFuture<Match> joinMatchToken(@NonNull @NonNull java.lang.String token)
SocketClient
joinMatchToken
in interface SocketClient
token
- A matchmaker ticket result object.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> leaveMatch(@NonNull @NonNull java.lang.String matchId)
SocketClient
leaveMatch
in interface SocketClient
matchId
- The match to leave.public com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> addMatchmaker()
SocketClient
addMatchmaker
in interface SocketClient
public com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> addMatchmaker(int minCount)
SocketClient
addMatchmaker
in interface SocketClient
minCount
- The minimum number of players to compete against.public com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> addMatchmaker(int minCount, int maxCount)
SocketClient
addMatchmaker
in interface SocketClient
minCount
- The minimum number of players to compete against.maxCount
- The maximum number of players to compete against.public com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> addMatchmaker(int minCount, int maxCount, java.lang.String query)
SocketClient
addMatchmaker
in interface SocketClient
minCount
- The minimum number of players to compete against.maxCount
- The maximum number of players to compete against.query
- A matchmaker query to search for opponents.public com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> addMatchmaker(int minCount, int maxCount, java.lang.String query, java.util.Map<java.lang.String,java.lang.String> stringProperties)
SocketClient
addMatchmaker
in interface SocketClient
minCount
- The minimum number of players to compete against.maxCount
- The maximum number of players to compete against.query
- A matchmaker query to search for opponents.stringProperties
- A set of k/v properties to provide in searches.public com.google.common.util.concurrent.ListenableFuture<MatchmakerTicket> addMatchmaker(int minCount, int maxCount, java.lang.String query, java.util.Map<java.lang.String,java.lang.String> stringProperties, java.util.Map<java.lang.String,java.lang.Double> numericProperties)
SocketClient
addMatchmaker
in interface SocketClient
minCount
- The minimum number of players to compete against.maxCount
- The maximum number of players to compete against.query
- A matchmaker query to search for opponents.stringProperties
- A set of k/v properties to provide in searches.numericProperties
- A set of k/v numeric properties to provide in searches.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> removeMatchmaker(@NonNull @NonNull java.lang.String ticket)
SocketClient
removeMatchmaker
in interface SocketClient
ticket
- The ticket returned by the matchmaker on join. See IMatchmakerTicket.Ticket.public void sendMatchData(@NonNull @NonNull java.lang.String matchId, long opCode, @NonNull @NonNull byte[] data)
SocketClient
sendMatchData
in interface SocketClient
matchId
- The Id of the match.opCode
- An operation code for the match state.data
- The new state to send to the match.public void sendMatchData(@NonNull @NonNull java.lang.String matchId, long opCode, @NonNull @NonNull byte[] data, UserPresence... presences)
SocketClient
sendMatchData
in interface SocketClient
matchId
- The Id of the match.opCode
- An operation code for the match state.data
- The new state to send to the match.presences
- The presences in the match to send the state.public com.google.common.util.concurrent.ListenableFuture<Rpc> rpc(@NonNull @NonNull java.lang.String id)
SocketClient
rpc
in interface SocketClient
id
- The ID of the function to execute.public com.google.common.util.concurrent.ListenableFuture<Rpc> rpc(@NonNull @NonNull java.lang.String id, java.lang.String payload)
SocketClient
rpc
in interface SocketClient
id
- The ID of the function to execute.payload
- The string content to send to the server.public com.google.common.util.concurrent.ListenableFuture<Status> followUsers(@NonNull java.lang.String... userIds)
SocketClient
followUsers
in interface SocketClient
userIds
- The user Ids to follow.public com.google.common.util.concurrent.ListenableFuture<Status> followUsers(java.util.List<java.lang.String> userIds, @NonNull java.lang.String... usernames)
SocketClient
followUsers
in interface SocketClient
userIds
- The user Ids to follow.usernames
- Usernames to follow.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> unfollowUsers(@NonNull java.lang.String... userIds)
SocketClient
unfollowUsers
in interface SocketClient
userIds
- The ids of users to unfollow.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> updateStatus(java.lang.String status)
SocketClient
updateStatus
in interface SocketClient
status
- The new status of the user.public com.google.common.util.concurrent.ListenableFuture<Party> createParty(boolean open, int maxSize)
SocketClient
createParty
in interface SocketClient
open
- Whether the party will require join requests to be approved by the party leader.maxSize
- Maximum number of party members.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> joinParty(@NonNull @NonNull java.lang.String partyId)
SocketClient
joinParty
in interface SocketClient
partyId
- A party ID.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> leaveParty(@NonNull @NonNull java.lang.String partyId)
SocketClient
leaveParty
in interface SocketClient
partyId
- A party ID.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> promoteParty(@NonNull @NonNull java.lang.String partyId, UserPresence userPresence)
SocketClient
promoteParty
in interface SocketClient
partyId
- A party ID.userPresence
- The presence of an existing party member to promote as the new leader.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> acceptParty(@NonNull @NonNull java.lang.String partyId, UserPresence userPresence)
SocketClient
acceptParty
in interface SocketClient
partyId
- Party ID to accept a join request for.userPresence
- The presence to accept as a party member.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> removeParty(@NonNull @NonNull java.lang.String partyId, UserPresence userPresence)
SocketClient
removeParty
in interface SocketClient
partyId
- Party ID to remove/reject from.userPresence
- The presence to remove or reject.public com.google.common.util.concurrent.ListenableFuture<Party> closeParty(@NonNull @NonNull java.lang.String partyId)
SocketClient
closeParty
in interface SocketClient
partyId
- A party ID.public com.google.common.util.concurrent.ListenableFuture<PartyJoinRequest> listPartyJoinRequest(@NonNull @NonNull java.lang.String partyId)
SocketClient
listPartyJoinRequest
in interface SocketClient
partyId
- A party ID.public com.google.common.util.concurrent.ListenableFuture<PartyMatchmakerTicket> addPartyMatchmaker(@NonNull @NonNull java.lang.String partyId, int minCount, int maxCount, @NonNull @NonNull java.lang.String query, java.util.Map<java.lang.String,java.lang.String> stringProperties, java.util.Map<java.lang.String,java.lang.Double> numericProperties, int countMultiple)
SocketClient
addPartyMatchmaker
in interface SocketClient
minCount
- Minimum total user count to match together.maxCount
- Maximum total user count to match together.query
- Filter query used to identify suitable users.stringProperties
- A set of k/v properties to provide in searches.numericProperties
- A set of k/v numeric properties to provide in searches.countMultiple
- Optional multiple of the count that must be satisfied.public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> removePartyMatchmaker(@NonNull @NonNull java.lang.String partyId, @NonNull @NonNull java.lang.String ticket)
SocketClient
removePartyMatchmaker
in interface SocketClient
partyId
- A party ID.public void sendPartyData(@NonNull @NonNull java.lang.String partyId, int opCode, @NonNull @NonNull byte[] data)
SocketClient
sendPartyData
in interface SocketClient
partyId
- The ID of the party.opCode
- An operation code for the party state.data
- The new state to send to the party.