public abstract class SocketService extends java.lang.Object
Constructor and Description |
---|
SocketService() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
accept() |
boolean |
accept(javax.websocket.Session session) |
abstract boolean |
accept(UserIdentity authenticatedUser) |
void |
broadcast(java.lang.String message)
Send message to all connected users.
|
void |
close(UserIdentity authorizedUser,
javax.websocket.CloseReason closeReason)
Close all sessions belonging to the given user identity.
|
abstract void |
disconnected()
An anonymous user has been disconnected.
|
abstract void |
disconnected(UserIdentity authenticatedUser)
The user has been disconnected.
|
abstract java.lang.String |
getEndPointName()
Note: the name is checked on initialization, changing the name run-time has no effect.
|
boolean |
hasSessions(UserIdentity authenticatedUser) |
void |
onClose(javax.websocket.Session session,
javax.websocket.CloseReason closeReason) |
void |
onError(javax.websocket.Session session,
java.lang.Throwable throwable)
The default implementation will simply print the exception to log and close the session.
|
void |
received(javax.websocket.Session session,
java.lang.String message) |
abstract void |
received(java.lang.String message)
Message received for an anonymous user.
|
abstract void |
received(UserIdentity authenticatedUser,
java.lang.String message) |
void |
send(java.lang.String message)
Send message to all unauthorized users
|
boolean |
send(UserIdentity authenticatedUser,
java.lang.String message)
Send message to the given authorized user
|
public SocketService()
public void onError(javax.websocket.Session session, java.lang.Throwable throwable)
session
- throwable
- public void close(UserIdentity authorizedUser, javax.websocket.CloseReason closeReason)
authorizedUser
- closeReason
- public boolean accept(javax.websocket.Session session)
session
- public void onClose(javax.websocket.Session session, javax.websocket.CloseReason closeReason)
session
- closeReason
- public void received(javax.websocket.Session session, java.lang.String message)
session
- message
- public boolean send(UserIdentity authenticatedUser, java.lang.String message)
authenticatedUser
- message
- public void send(java.lang.String message)
message
- public void broadcast(java.lang.String message)
message
- public boolean hasSessions(UserIdentity authenticatedUser)
authenticatedUser
- public abstract boolean accept(UserIdentity authenticatedUser)
authenticatedUser
- public abstract boolean accept()
public abstract void received(UserIdentity authenticatedUser, java.lang.String message)
authenticatedUser
- message
- public abstract void received(java.lang.String message)
message
- public abstract void disconnected(UserIdentity authenticatedUser)
authenticatedUser
- public abstract void disconnected()
public abstract java.lang.String getEndPointName()
Copyright © 2015 Tampere University of Technology, Pori Department.