Package dev.arbjerg.lavalink.api
Interface ISocketContext
-
- All Implemented Interfaces:
public interface ISocketContextRepresents a WebSocket connection
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumISocketContext.StatePossible states of a WebSocket connection.
-
Method Summary
Modifier and Type Method Description abstract IPlayergetPlayer(Long guildId)Returns the player of a guild. abstract UnitdestroyPlayer(Long guildId)Destroys the player for the Guild corresponding to guildId. abstract <T extends Any> UnitsendMessage(SerializationStrategy<T> serializer, T message)Sends message to the WebSocket client UnitsendMessage(JsonElement message)Sends message to the WebSocket client abstract UnitcloseWebSocket()Closes this WebSocket abstract UnitcloseWebSocket(Integer closeCode)Closes this connection with closeCode. abstract UnitcloseWebSocket(Integer closeCode, String reason)Closes this connection with closeCode and code. abstract StringgetSessionId()The session id of this socket connection. abstract LonggetUserId()The User ID of the Client. abstract StringgetClientName()The name of this connections client if specified. abstract Map<Long, IPlayer>getPlayers()A read-only map of all players associated by their guild. abstract ISocketContext.StategetState()The state of the context. -
-
Method Detail
-
getPlayer
abstract IPlayer getPlayer(Long guildId)
Returns the player of a guild. Never returns null.
- Parameters:
guildId- the guild the player is associated with
-
destroyPlayer
abstract Unit destroyPlayer(Long guildId)
Destroys the player for the Guild corresponding to guildId.
-
sendMessage
abstract <T extends Any> Unit sendMessage(SerializationStrategy<T> serializer, T message)
Sends message to the WebSocket client
- Parameters:
serializer- a SerializationStrategy capable of serializing T.
-
sendMessage
Unit sendMessage(JsonElement message)
Sends message to the WebSocket client
-
closeWebSocket
abstract Unit closeWebSocket()
Closes this WebSocket
-
closeWebSocket
abstract Unit closeWebSocket(Integer closeCode)
Closes this connection with closeCode.
-
closeWebSocket
abstract Unit closeWebSocket(Integer closeCode, String reason)
-
getSessionId
abstract String getSessionId()
The session id of this socket connection.
-
getClientName
abstract String getClientName()
The name of this connections client if specified.
-
getPlayers
abstract Map<Long, IPlayer> getPlayers()
A read-only map of all players associated by their guild.
-
getState
abstract ISocketContext.State getState()
The state of the context.
-
-
-
-