public.javadoc.org.spincast.core.websocket.WebsocketContext.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
WebsocketContext (org.spincast:spincast-framework 1.0.0 API)
org.spincast.core.websocket
Interface WebsocketContext<W extends WebsocketContext<?>>
-
- All Known Subinterfaces:
- DefaultWebsocketContext
- All Known Implementing Classes:
- DefaultWebsocketContextDefault
public interface WebsocketContext<W extends WebsocketContext<?>>
The base interface for a WebSocket context.
A WebSocket context is the object passed to a WebSocket
controller when an event for a particular peer occured.
For example when a message is sent from a peer, or if
the peer closed the WebSocket connection.
-
-
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type
Method and Description
void
closeConnectionWithCurrentPeer()
Closes the connection with the
current peer.
<T> T
get(Class<T> clazz)
Shortcut to get an instance from Guice.
<T> T
get(com.google.inject.Key<T> key)
Shortcut to get an instance from Guice.
String
getEndpointId()
The id of the endpoint
Locale
getLocaleToUse()
The best Locale to use, as resolved by
the LocaleResolver
during the
initial HTTP request.
String
getPeerId()
The id of the peer.
TimeZone
getTimeZoneToUse()
The best TimeZone to use, as resolved by
the TimeZoneResolver
.
com.google.inject.Injector
guice()
Easy access to the Guice context.
JsonManager
json()
Easy access to the JsonManager
,
Json related methods.
void
sendMessageToCurrentPeer(byte[] message)
Sends a byte array message to the
current peer.
void
sendMessageToCurrentPeer(String message)
Sends a String message to the
current peer.
TemplatingEngine
templating()
Easy access to the TemplatingEngine
,
templating related methods.
XmlManager
xml()
Easy access to the XmlManager
,
XML related methods.
-
-
Method Detail
-
getEndpointId
String getEndpointId()
The id of the endpoint
-
getPeerId
String getPeerId()
The id of the peer.
-
sendMessageToCurrentPeer
void sendMessageToCurrentPeer(String message)
Sends a String message to the
current peer.
Same as WebsocketEndpointManager#sendMessage(getPeerId(), message)
-
sendMessageToCurrentPeer
void sendMessageToCurrentPeer(byte[] message)
Sends a byte array message to the
current peer.
Same as WebsocketEndpointManager#sendMessage(getPeerId(), message)
-
closeConnectionWithCurrentPeer
void closeConnectionWithCurrentPeer()
Closes the connection with the
current peer.
Same as WebsocketEndpointManager#closePeer(getPeerId())
-
json
JsonManager json()
Easy access to the JsonManager
,
Json related methods.
-
xml
XmlManager xml()
Easy access to the XmlManager
,
XML related methods.
-
templating
TemplatingEngine templating()
Easy access to the TemplatingEngine
,
templating related methods.
-
guice
com.google.inject.Injector guice()
Easy access to the Guice context.
-
get
<T> T get(Class<T> clazz)
Shortcut to get an instance from Guice. Will
also cache the instance (as long as it is
request scoped or a singleton).
-
get
<T> T get(com.google.inject.Key<T> key)
Shortcut to get an instance from Guice. Will
also cache the instance (as long as it is
request scoped or a singleton)
-
getLocaleToUse
Locale getLocaleToUse()
The best Locale to use, as resolved by
the LocaleResolver
during the
initial HTTP request.
-
getTimeZoneToUse
TimeZone getTimeZoneToUse()
The best TimeZone to use, as resolved by
the TimeZoneResolver
.
Copyright © 2019. All rights reserved.